Out of Variable Space ??!!
Hatem
Posts: 20
Hello everyone. I am trying to write a code which will have my·Boe-Bot navigate to a desired point or a predetermined path using the Ping)), IR Sensors, and HM55B Compass. I am still in the process of writing the code and I have a problem with the one of the variables. It keeps telling me: "Out of Variable Space". What shall I do to fix this problem?
Comments
Most programs have ways in which you can·optimize the code to use less space. If you could post your program, maybe someone can see a way to help.
Post Edit·-- The solution is to make some of your VARs do double-duty.
Post Edited (PJ Allen) : 3/23/2008 4:05:37 AM GMT
You can also use less than a full byte for some variables. A nibble is a 4 bit variable and you can declare a variable as a single bit if that's useful.
You can also use a word in one part of a program and use the same locations as two separate bytes or one byte and two nibbles, etc.
Essentially, you have only 26 bytes of variables and you have to reuse the space as much as you can for complex programs to fit in the Stamp.
1) The Boe-Bot will start moving forward for an about 2 meters. Then it will turn left for about 2 meters. Then it must turn right for about 4 meters. Then turn left again for about 2 meters. Then it must stop.
2) If there is an object on the way, the Boe-Bot must avoid colliding with it, and then it must continue on its original path.
I was thinking on using the standard IR routine with modified subroutines added in the IF statements. For example, if the Boe-Bot detected an object on the left side, it will go to subroutine named "Turn_Right". In this subroutine, the Boe-Bot will turn right, move forward for about 50 cm, then turn left for another 50 cm then another left for 50 cm, then turn right and resume the original course. Basically, it moved in a square shape around the object.
I hope you do understand the whole picture I am trying to explain
One of the things that can help is to actually measure the speed or the distance covered in a specific period of time (and convert to speed) at several different servo control pulse widths for each of the servos (because they're unlikely to be the same) and define these as constants in your program. That way you will have some confidence that you can make the BoeBot go an approximate known distance.
in the program to pinpoint the problem.
I'm guessing that it is in the DO LOOP in your Get_Angle subroutine.
For a start, I'd modify that section of the code to read:
You will also have to add
Holding the BOEBOT off the ground will let you see the DEBUG screen.
If debugging the code is needed when the PC isn't connected, you could also
add an LED that is turned on when you begin to test for Status and the Status indicates READY.
Then turn the LED off after it becomes ready. A PAUSE 1000 will let you see if it becomes ready
right away.
phil