EasyManua.ls Logo

Keyestudio KS0077 - Project 7: Active Buzzer Operation

Keyestudio KS0077
142 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
keyestudio
www.keyestudio.com
28
val=digitalRead(inpin);// read the level value of pin 7 and assign if to val
if(val==LOW)// check if the button is pressed, if yes, turn on the LED
{ digitalWrite(ledpin,LOW);}
else
{ digitalWrite(ledpin,HIGH);}
}
//////////////////////////////////////////////////////////
Test Result
When the button is pressed, LED is on, otherwise, LED remains off. In this way, the button
controlled LED experiment is completed. The simple principle of this experiment is widely used
in a variety of circuit and electric appliances. You can easily come across it in your daily life. One
typical example is when you press a certain key on your phone, the backlight will be on.
*******************************************************************************
Project 7: Active Buzzer
Introduction
Active buzzer is widely used as a sound making element on computer, printer, alarm, electronic
toy, telephone, timer and more. It has an inner vibration source. Simply connect it with 5V power
supply, it can buzz continuously.