▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Involvement and committment can be best understood by looking at a plate of ham and eggs. The chicken was involved, but the pig was committed. ANON
The GP2D120 is an analog output device that ranges from about 0.4 volts to 3.3 vollts depending on the distance to the object. On powerup, the sensor takes about 45ms to stablize. If you are thinking digital, all you are seeing is an unstable voltage on the output for that 50ms. Then the output voltage varies with the distance detected. By placing an object about 4cm from the sensor, the output should be about 3.3 volts. At 30cm the output voltage should be about 0.4 volts.
Thanks LilDi. Do you know any PBasic code to interface between the sensors and a Parallax(28300) motherboard? I'm having difficulty in writing to the AD converter on the board.
Here's a sample program, adapted from the GPIO3 doc, that reads ADC port 0 on socket "B" and outputs the value read via DEBUG. Try it with your sensor to see if you get data that makes sense.
' {$STAMP BS2pe}
' {$PBASIC 2.5}
owio PIN 6 ' PIN 10 for socket "A"; PIN 6 for socket "B".
Voltage VAR Word
Busy VAR Bit
DO
OWOUT Owio, 0, [noparse][[/noparse]%00001011]
DO : OWIN Owio, 4, [noparse][[/noparse]Busy] : LOOP WHILE Busy
OWIN Owio, 0, [noparse][[/noparse]Voltage.HIGHBYTE, Voltage.LOWBYTE]
DEBUG DEC Voltage, CR
LOOP
i'm building a robot which is supposed to run on 2 stepper motors until it senses an obstacle which is a specific distance away, say 10 cm? is there a way to program such that the motors will keep running until the desired distance is reached? im using the same sharp sensor as above. i have tried some ways but the stepper motors are vibrating too much. why is this so?
1) Please start your own thread rather than hijacking a "similar one".
2) You will have to provide much more information than you've done. At a minimum, provide a circuit diagram of your robot as an attachment to your message. Also, attach your source program and make sure there are comments in it that explain what you're trying to do in that section of the program. Vibration may be due to your program being too slow between motor steps.
Comments
Which Sharp sensors are you using?
Regards,
Bruce Bates
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Involvement and committment can be best understood by looking at a plate of ham and eggs. The chicken was involved, but the pig was committed. ANON
-Phil
i'm building a robot which is supposed to run on 2 stepper motors until it senses an obstacle which is a specific distance away, say 10 cm? is there a way to program such that the motors will keep running until the desired distance is reached? im using the same sharp sensor as above. i have tried some ways but the stepper motors are vibrating too much. why is this so?
thanks
2) You will have to provide much more information than you've done. At a minimum, provide a circuit diagram of your robot as an attachment to your message. Also, attach your source program and make sure there are comments in it that explain what you're trying to do in that section of the program. Vibration may be due to your program being too slow between motor steps.