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);
- pinMode(A2, INPUT);
- Serial.begin(9600);
- }
- // the loop function runs over and over again forever
- void loop() {
- delay(1);
- int value1 = analogRead(A1);
- int value2 = analogRead(A2);
- if (IS_ANALOG_LOW(value1) || IS_ANALOG_LOW(value2)) {
- Serial.println("Obstacle");
- } else {
- }
- delay(500);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement