Conversion to Basic ATOM IDE 5.3.0.1

I am attempting to convert to this newer v5.3.0.1 IDE, but am having some problems… I ran into the Sbyte bug in the v2.2.1.1 IDE, and the fix proposed does not work for me for some reason.

How do I properly convert the following lines:

IR_Distance var word(2)	' Distance object was detected at
IR_Detected var nib(2)	' Was object detected? 0 = No, 1 = Yes
IR_Status var byte		' IR Detection status - 1 = Left Side, 2 = Right side, 3 = BOTH sides, 4 = Turret IR
scanrange var word		' A/D result variable
floating var long		' Floating point math result storage

scantable bytetable     80,80,80,80,80,80,80,80,80,78, |
                                    76,74,72,70,68,66,64,62,60,59, |
                                    58,57,55,53,52,51,50,49,48,47, |
                                    45,43,42,41,40,39,38,37,35,33, |
                                    32,31,30,30,29,29,28,28,27,27, |
                                    26,26,26,25,25,25,24,24,24,23, |
                                    23,22,22,21,21,20,20,20,19,19, |
                                    18,18,18,17,17,16,16,16,15,15, |
                                    15,14,14,13,13,13,12,12,11,11, |
                                    11,10,10,10,10,10,10,10,10,10


   		floating = float scanrange fdiv 5.12            ' Limit value to <200 values
		IR_Distance(index) = scantable(int floating)	' Convert A/D to measurement

I know the new IDE uses * / - and - for floating point math operations now, so that part is easy - just replace fdiv with /. It’s the other parts of the last two lines I am having problems getting to work with the new IDE. I based my code on some I found on the Lynxmotion site, so am not really familiar with what these lines are doing and what result I should get from them. They worked as is in the 2.2.1.1 IDE so I never had to deal with this problem and don’t know how to deal with it now.

There is no manual for the 5.3.0.x IDE! :frowning: :frowning:

8-Dale

I found a different work around for the Sbyte bug, so I won’t have to convert my code to the newer 5.3.0.1 IDE afterall. :smiley:

I defined a new variable called negscan of type bit that I set in the Scan_Turret routine if the robot needs to scan in the negative (to the left) direction.

This variable is tested in the Turn_To_Bearing routine and the robot turns in the correct direction based on whether the scan was to the left (right side detection) or right (left side detection).

This is going to work majorly awesome when I have a compass installed on Walter and have the Nubotics Wheel Watchers and Wheel Commander installed for the locomotion system. With the compass and Nubotics hardware, Walter will know the exact compass bearing something is detected at or the exact bearing of a clear path and be able to turn to that exact compass bearing using the Wheel Commander, turn to a relative angle from the direction he is currently headed.

8-Dale

Just so anyone else has a similar question abou tthe 5.3.0.1 compiler…

IR_Distance var word(2) ’ Distance object was detected at
IR_Detected var nib(2) ’ Was object detected? 0 = No, 1 = Yes
IR_Status var byte ’ IR Detection status - 1 = Left Side, 2 = Right side, 3 = BOTH sides, 4 = Turret IR
scanrange var word ’ A/D result variable
floating var float ’ Floating point math result storage

scantable bytetable 80,80,80,80,80,80,80,80,80,78, |
76,74,72,70,68,66,64,62,60,59, |
58,57,55,53,52,51,50,49,48,47, |
45,43,42,41,40,39,38,37,35,33, |
32,31,30,30,29,29,28,28,27,27, |
26,26,26,25,25,25,24,24,24,23, |
23,22,22,21,21,20,20,20,19,19, |
18,18,18,17,17,16,16,16,15,15, |
15,14,14,13,13,13,12,12,11,11, |
11,10,10,10,10,10,10,10,10,10

floating = (TOFLOAT scanrange)/ 5.12 ’ Limit value to <200 values
IR_Distance(index) = scantable(TOINT floating) ’ Convert A/D to measurement

5.3.0.1 now has a FLOAT type variable. The old Float and Int conversion commands were changed to TOFLOAT and TOINT.

Thanks much!

8-Dale