Last active
June 10, 2020 12:00
-
-
Save ampulhetadosaber/d2f5b7769c6459e7d0db00593eb96333 to your computer and use it in GitHub Desktop.
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
#include <HCSR04.h> //Inclui a biblioteca em nosso programa | |
UltraSonicDistanceSensor SensorDeDistancia(10, 11); /* Estamos declarando o nosso sensor, entenda a estrutura: | |
UltraSonicDistanceSensor *Nome do sensor*(Pino do Trigger, Pino do Echo)*/ | |
void setup () | |
{ | |
Serial.begin(9600); //Inicializa a Serial | |
} | |
void loop () | |
{ | |
// A cada meio segundo lê o sensor e printa a distância em centimetros: | |
Serial.println(SensorDeDistancia.measureDistanceCm()); | |
delay(500); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment