Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <Ultrasonic.h>
- #define pino_trigger 4
- #define pino_echo 5
- int distancia;
- //Inicializa o sensor nos pinos definidos acima
- Ultrasonic ultrasonic(pino_trigger, pino_echo); // (Trig PIN,Echo PIN)
- void setup() {
- Serial.begin(9600);
- }
- void loop()
- {
- distancia = ultrasonic.Ranging(CM);
- Serial.print(distancia); // CM or INC
- Serial.println("cm");
- delay(100);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement