Open T1A5MA opened 6 years ago
Hi - on a very cursory look at the Parallax sensor, it looks like it provides a Pulse Width proportional to the distance, rather than the analog voltage in my example.
<158> distance = analogRead(DISTANCE_SENSOR); will need to be replaced with something like this (documentation here - https://www.arduino.cc/en/Reference.PulseIn): <158> distance = pulseIn(DISTANCE_SENSOR); and the parameters below modified to suit: <20> #define DETECTED_RANGE 100 // an object within this range is a target <21> #define CLOSE_RANGE 300 // object is in range to attack
Hi!
We are trying to use this code, but with a Parallax proximity sensor. We are not getting the expected result, any ideas why?