Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define TRIGGER 3
- #define SPEAKER 4
- #define DELAY 100
- #define FREQUENCY 2000
- void setup() {
- pinMode(TRIGGER, INPUT);
- pinMode(SPEAKER, OUTPUT);
- }
- void loop() {
- while(digitalRead(TRIGGER)) {}
- while(!digitalRead(TRIGGER)) {
- tone(SPEAKER, FREQUENCY);
- delay(DELAY);
- noTone(SPEAKER);
- delay(DELAY);
- }
- }
Add Comment
Please, Sign In to add comment