else
{
digitalWrite(LED, LOW); //the LED is off
}
delay(100); //delay in 100ms
}
Conclusion
: when the button is pressed, the LED lights up; otherwise, it
remains off.
Project 4: Passive Buzzer
(1)Description
There are prolific interactive works completed by Arduino. The most
common one is sound and light display. We always use LED to make
experiments. For this lesson, we design circuit to emit sound. The universal
sound components are buzzer and horns. Buzzer is easier to use. And
buzzer includes about active buzzer and passive buzzer. In this experiment,
we adopt passive buzzer.
While using passive buzzer, we can control different sound by inputting
square waves with distinct frequency. During the experiment, we control
code to make buzzer sound, begin with “tick, tick” sound, then make
passive buzzer emit “do re mi fa so la si do”, and play specific songs.