Legacy Forum: Preserving Nearly 20 Years of Community History - A Time Capsule of Discussions, Memories, and Shared Experiences.

basic, BASIC help please.

Hitec robotics including ROBONOVA humanoid, HSR-8498HB servos, MR C-3024 Controllers and RoboBasic
2 postsPage 1 of 1
2 postsPage 1 of 1

basic, BASIC help please.

Post by plingboot » Tue Nov 07, 2006 11:59 am

Post by plingboot
Tue Nov 07, 2006 11:59 am

Hi all,
Last night i finally managed to get both the gyro and the tilt sensor working on my RN1, but to be honest i don't fully understand how i did it.

I uncommented the tilt line and pasted some gyro code from a pdf on the hitec site, uploaded the template and it worked.

Now, when i tried to test the sonar - i just got a whole bunch of errors in my code.

Please could someone either enlighten me or point me at a pdf to explain (in clear english) the basics of BASIC.

I've read (much to the amusement of my lady wife) both the manual and the BASIC commands manual and it all 'looked' clear and is probably great when your up and running, but it seems to miss really basic info to help folk get of the ground.

ie:
1. are there mandatory elements required in the code?
2. is there good coding practice?
3. what's the difference between "DIM a AS BYTE" and "DIM a AS INTEGER" and when is one used over the other.

these are just some of the dumb questions i need help with please.
Hi all,
Last night i finally managed to get both the gyro and the tilt sensor working on my RN1, but to be honest i don't fully understand how i did it.

I uncommented the tilt line and pasted some gyro code from a pdf on the hitec site, uploaded the template and it worked.

Now, when i tried to test the sonar - i just got a whole bunch of errors in my code.

Please could someone either enlighten me or point me at a pdf to explain (in clear english) the basics of BASIC.

I've read (much to the amusement of my lady wife) both the manual and the BASIC commands manual and it all 'looked' clear and is probably great when your up and running, but it seems to miss really basic info to help folk get of the ground.

ie:
1. are there mandatory elements required in the code?
2. is there good coding practice?
3. what's the difference between "DIM a AS BYTE" and "DIM a AS INTEGER" and when is one used over the other.

these are just some of the dumb questions i need help with please.
plingboot
Savvy Roboteer
Savvy Roboteer
Posts: 108
Joined: Thu Oct 26, 2006 1:00 am
Location: the gutter, south west london

Post by hivemind » Tue Nov 07, 2006 12:26 pm

Post by hivemind
Tue Nov 07, 2006 12:26 pm

Well it is good that you have gotten this far -gyros and accelerometer are awesome. I never tried the sonar myself, but I think I recall reading an old forum post about it, you may want to search around.

To briefly answer your questions,

1) Well, no. That is to say, you do not HAVE to turn motors on or any of that. I would recommend the Fill 255,10000 and GOTO AUTO, as it places the start of your code in the correct spot, but once again, you do not need this.

2) Always. But being as RoboBasic is very basic (in the literal sense of the word) as far as coding goes, there isnt too much to worry about. That being said, you dont have much of the processor to work with, so doing make a long algorithm for something that can be done easily using a FOR loop or something to that extent.

Furthermore, you should not have RETURN 's in bad places in your code where you have nothing to return to. That doesnt end up well.

3) a byte = 256 character (the value that can be sent to the sensors or servos is that of a byte) and an integer = 16bit character. The integer is bigger, so you shouldnt really use it if you dont have to.

hope that helps a little.
Well it is good that you have gotten this far -gyros and accelerometer are awesome. I never tried the sonar myself, but I think I recall reading an old forum post about it, you may want to search around.

To briefly answer your questions,

1) Well, no. That is to say, you do not HAVE to turn motors on or any of that. I would recommend the Fill 255,10000 and GOTO AUTO, as it places the start of your code in the correct spot, but once again, you do not need this.

2) Always. But being as RoboBasic is very basic (in the literal sense of the word) as far as coding goes, there isnt too much to worry about. That being said, you dont have much of the processor to work with, so doing make a long algorithm for something that can be done easily using a FOR loop or something to that extent.

Furthermore, you should not have RETURN 's in bad places in your code where you have nothing to return to. That doesnt end up well.

3) a byte = 256 character (the value that can be sent to the sensors or servos is that of a byte) and an integer = 16bit character. The integer is bigger, so you shouldnt really use it if you dont have to.

hope that helps a little.
hivemind
Savvy Roboteer
Savvy Roboteer
User avatar
Posts: 211
Joined: Sat Jul 01, 2006 1:00 am
Location: between my computer and robot.


2 postsPage 1 of 1
2 postsPage 1 of 1