Devices & Components
Arduino Uno Rev3
Rotary potentiometer (generic)
Buzzer
Software & Tools
Arduino IDE
Project description
Code
KY-006 buzzer
arduino
1int buzzer = 10; 2int pot = A0; 3int x; 4void setup() { 5 // put your setup code here, to run once: 6 pinMode(buzzer,OUTPUT); 7 Serial.begin(9600); 8 9} 10 11void loop() { 12 // put your main code here, to run repeatedly: 13 x = analogRead(pot) / 102,4; 14 15 Serial.println(x); 16 digitalWrite(buzzer, HIGH); 17 delay(x); 18 digitalWrite(buzzer, LOW); 19 delay(x); 20} 21
KY-006 buzzer
arduino
1int buzzer = 10; 2int pot = A0; 3int x; 4void setup() { 5 // 6 put your setup code here, to run once: 7 pinMode(buzzer,OUTPUT); 8 Serial.begin(9600); 9 10} 11 12void 13 loop() { 14 // put your main code here, to run repeatedly: 15 x = analogRead(pot) 16 / 102,4; 17 18 Serial.println(x); 19 digitalWrite(buzzer, HIGH); 20 delay(x); 21 22 digitalWrite(buzzer, LOW); 23 delay(x); 24} 25
Downloadable files
KY-006 buzzer
...
KY-006 buzzer
Comments
Only logged in users can leave comments