arduino-course/Week 2/Analog Buzzer/Analog Buzzer.ino

15 lines
210 B
Arduino
Raw Permalink Normal View History

2019-11-15 23:52:50 +01:00
// Analog Buzzer
int Buzzer = 5;
void setup() {
pinMode(Buzzer, OUTPUT);
}
void loop() {
int val = analogRead(A5);
digitalWrite(Buzzer, HIGH);
delay(val);
digitalWrite(Buzzer, LOW);
delay(val);
}