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!
8-Dale