#define BUZZER 0
#define PUSH 1
void setup() {
// put your setup code here, to run once:
pinMode(BUZZER, OUTPUT);
pinMode(PUSH, INPUT);
}
void loop() {
if(digitalRead(PUSH) == 0){
tone(BUZZER, 100);
delay(100);
}
else{
tone(BUZZER, 0);
}
// put your main code here, to run repeatedly:
delay(1); // this speeds up the simulation
}
Loading
pi-pico-w
pi-pico-w