Created
July 22, 2020 01:02
-
-
Save HectorTorres/1b399462414d2d17ecb563955cc4e6c4 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
#define PinBuzzer 7 | |
#define SoundTime 2000 | |
#define PinSignal 8 | |
void setup() { | |
pinMode(PinBuzzer, OUTPUT); | |
pinMode(PinSignal, INPUT); | |
} | |
void loop() { | |
if(digitalRead(PinSignal)==HIGH){ | |
digitalWrite(PinBuzzer,HIGH); | |
delay(SoundTime); | |
} | |
else{ | |
digitalWrite(PinBuzzer,LOW); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment