Hitachi-LG LDS Lidar icon Hitachi-LG LDS Lidar Hitachi-LG LDS 360-degree LiDAR driver streaming scans into ARC NMS for obstacle detection, SLAM use, Arduino hookup, config options and variables. Try it →
USA
Asked — Edited
Resolved Resolved by DJ Sures!

:pingtest
Goto(SonarTest)
say("Distance" + $Distance + "inches")
sleep(5000)
Goto(pingtest)

:SonarTest
$Distance = Round(GetPing(D9,D8)/2.54,0)
if(1 < 1000)
sleep(25)
Return() 
endif  
goto(SonarTest) 

So, it's apparently been too many years since I've attempted to write some code, as I'm getting stumped pretty easy. Can anyone tell me why the Return() command above is getting ignored? When the code gets to that line it, it keeps going until it gets to:

goto(SonarTest)

then keeps repeating that loop. The if statement before the Return statement is true and should cause the code to jump back to the 3rd line of code since the Return() in encapsulated between the IF and the EndIf, the way I understand things.


ARC Pro

Upgrade to ARC Pro

Stay at the forefront of robot programming innovation with ARC Pro, ensuring your robot is always equipped with the latest advancements.

#2  

Thanks DJ, that fixed it.:)