Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   General Forum (http://www.chiefdelphi.com/forums/forumdisplay.php?f=16)
-   -   Ultrasonic Sensor (http://www.chiefdelphi.com/forums/showthread.php?t=101373)

SoyStuff 28-01-2012 13:38

Ultrasonic Sensor
 
We're writing our robot's code in C++. So far, so good, but we can't seem to figure out how to work with the ultrasonic sensor that came with the kit of parts. We're using the AnalogChannel class, but that isn't working. How should we initialize it. We can't use the Ultrasonic class because that's designed for a different ultrasonic sensor. The one that we're using, which is the one from the kit of parts, can be found at this website: https://www.adafruit.com/products/172. Does anyone have any idea what we should do? What class do we use? Thanks.

theprgramerdude 28-01-2012 14:04

Re: Ultrasonic Sensor
 
AnalogChannel works as intended - Which probably means you aren't initializing it right or you're hooking it up wrong. If you have it hooked into slot 1 at port X, you should have something along the lines of

AnalogChannel* ultrasonic = new AnalogChannel(1, X);

Then, you just do ultrasonic->GetVoltage(); to return the voltage back from it.

As a reference, http://maxbotix.com/products/LV.htm
I don't recall the exact model, but make sure pin 1 is grounded to the analog input module (0v, or -, depending on the markings on the analog input module), pin 2 is connected to the +5V on the analog input module, and pin 5, the voltage output (not any of the other pins), is connected to the sensor pin on the analog module.


All times are GMT -5. The time now is 20:30.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi