Keyestudio KS0436 Kit Manual page 67

Table of Contents

Advertisement

67
1) Connect the
REV4
Board to a USB port on your computer.
Upload Code:
2) Open the program in the code folder- Circuit 5 Buzzer, or directly
copy and paste the code below on the Ardunio IDE.
3) Select UPLOAD to program the sketch on the UNO Board.
After the connection, let's begin the program compiling.
int buzzer=8;// select digital IO pin for the buzzer
void setup()
{
pinMode(buzzer,OUTPUT);// set digital IO pin pattern, OUTPUT to be
output
}
void loop()
{ unsigned char i,j;//define variable
while(1)
{ for(i=0;i<80;i++)// output a frequency sound
{ digitalWrite(buzzer,HIGH);// sound
delay(1);//delay1ms
digitalWrite(buzzer,LOW);//not sound

Advertisement

Table of Contents
loading

Table of Contents