Loginskip to content

March 3rd, 2007

US Ping in RobotC

As I’ve explained here, using US sensors in ping mode is quite easy using NXT-G. For users using RobotC, the ideal solution would be a custom “device driver” for this purpose. Until I (or anyone else..) publish such a driver here is a temporary solution. The following code initializes two US sensors in ping mode, and alternate their pings showing both measured distances on screen.

UPDATE: since WordPress somehow changes the code when you cut and paste it into RobotC (resulting in errors), I’ve put it online here.