|
Re: Programming MaxSonar EZ1 Ultrasonic Rangefinder in Simple Robot Template
We used analog coming out of the 9201 module in the rio wire red to +5 black to fend and the signal to an on the sensor
I have some new coders so I am not bothering with subroutines so we just put the commands in the main program. So this is inelegant code but it works.
float volt,inches;
AnalogChannnel *range ;
Range =new AnalogChannel(1,1);
The command to call and convert to inches is
volt = range ->GetVoltage();
inches = volt/0.009766;
That is the conversion factor and for us seems quite accurate within 3 feet.
Just use inches wherever you need the range data
We can't seem to get readings above that so if anyone has a suggestion for boosting the power of his device to the supposed voltage of 5v I would appreciate an answer to that.
|