I'm new to everything arduino and electronics, and c++.
Having said that, I'm trying to follow the tutorial listed here: http://blog.miguelgrinberg.com/post/building-an-arduino-robot-part-ii-programming-the-arduino
I have a sharp distance sensor, model number 2y0a02-f-2z . I couldn't find the datasheet for this specific model but i got one that looks similar... found here:http://sharp-world.com/products/device/lineup/data/pdf/datasheet/gp2y0a02_e.pdf
The distance sensor in the tutorial has 2 inputs - a trigger and an echo. Mine only has one wire for the input. So I've wired everything up exactly the same as the tutorial shows on the bread board diagram, except that instead of having 2 inputs (A0 and A1) I only have A0. So, if you ignore the "purple" wire that is connected to A1 in the tutorial's wiring diagram for the distance sensor, that's basically what I have.Problem
I compiled and ran the code but it doesn't return any distances. I waved my hand infront of it really close but it doesn't detect it. What I've tried so far
I've tried to confirm that I've wired it up properly. I double checked that:
- my "red" wire on the distance sensor, labelled Vcc is lined up with the 5v on the breadboard...
- the black to wire labelled GND to the ground on the board.
- the yello wire labelled Vo is matched up with the wire that goes from the breadboard to A0 on the arduino board. it matches the "orange" wire in the tutorial's wiring diagram.
In the code, I've tried to pass 0 (zero), or null in place of the ECHO_PIN, but that didn't fx the problem.
NewPing DistanceSensor(TRIGGER_PIN, 0, MAX_DISTANCE);
NewPing DistanceSensor(TRIGGER_PIN, null, MAX_DISTANCE);
Any suggestions would be appreciated.
that's the component i bought...
and the model number is a little different than whats printed on the unit... so i'm going to search for the datasheet using the model number on ebay. In the mean time, if you have any other suggestions,please let me know. I'm all ears!!