Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <Wire.h>
- #define IS_ANALOG_LOW(x) x < 50
- void setup() {
- // initialize digital pin LED_BUILTIN as an output.
- pinMode(A1, INPUT);
- Serial.begin(9600);
- }
- // the loop function runs over and over again forever
- void loop() {
- delay(1);
- int value = analogRead(A1);
- if (IS_ANALOG_LOW(value)) {
- Serial.println("Obstacle");
- } else {
- }
- delay(500);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement