Hi there Guys,
RE: Maxsonar range sensor passing constant values…
I recently purchased a nice little Maxsonar EZ4 sensor for an artwork and it sensed accurately with it’s first test.
Subsequently, I created a new project and the sensor is now reading as (raw data -i.e. no conversion - via serial monitor):
757
756
757
757
757
757
758
757
758
758
759 …
The Arduino microcontroller is reading the sensor’s AN output, powered off the +5v pin and ground pin.
I swapped out the microcontroller to test again and received the same results, even when moving a large book back and forth by a foot or three directly in front of the sensor.
The test sketch initializes the analog pin to 0 on start and loops every 500 ms for the reading.
Is there a way to re-set the sensor unit, or based on the constant readings has it been damaged?
Any advice much appreciated!
Thanks,
Rich.
// using the maxsonar quick start (from) http://www.adafruit.com
int sonarPin = 0; //pin connected to analog out on maxsonar sensor
int inchesAway = 0;
void setup() {
//none
}
void loop() {
inchesAway = analogRead(sonarPin);
delay(500);
Serial.begin(9600);
Serial.println(inchesAway);
}