Created
October 15, 2019 15:14
-
-
Save rburnett3/86044b1640208a7f4abf13240e2cb25d to your computer and use it in GitHub Desktop.
MB7389 analog voltage
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
print_data(); | |
delay(1000); | |
}/* Arduino example code for MaxBotix MB7389 HRXL-MaxSonar-WR weather resistant ultrasonic distance sensor: analog voltage output. More info: www.makerguides.com */ | |
#define sensorPin A0 | |
int distance = 0; | |
void setup() { | |
Serial.begin(9600); | |
} | |
void read_sensor() { | |
distance = analogRead(sensorPin) * 5; | |
} | |
void print_data() { | |
Serial.print("distance = "); | |
Serial.print(distance); | |
Serial.println(" mm"); | |
} | |
void loop() { | |
read_sensor(); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
HI this sensor working normally? Or have a variable meansuring? I'm using one but have a lof of disturb and change de value, but the object keep in same distance, I'm looking for other type of sensor for can try end my project, can you help me? Do you recomend this sensor?