Arduino – BUZZER
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
int light=0; void setup() { Serial.begin(9600); } void loop() { light=analogRead(A4); Serial.print("Light : "); Serial.println(light); if (light < 100) { noTone(6); } else { tone(6, 784); delay(500); tone(6, 1047); delay(500); } } |