Created
August 17, 2015 04:57
-
-
Save buildcircuit/e3625a0d6d3ef713b8be to your computer and use it in GitHub Desktop.
Active buzzer test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int buzzer=8;// Set the control the buzzer digital IO pin | |
void setup() | |
{ | |
pinMode(buzzer,OUTPUT);// Setting the digital IO pin mode , OUTPUT is Wen out | |
} | |
void loop() | |
{ | |
unsigned char i,j;// Define the variable | |
while(1) | |
{ | |
for(i=0;i<80;i++)// Wen a frequency sound | |
{ | |
digitalWrite(buzzer,HIGH);// Sound | |
delay(1);//delay 1ms | |
digitalWrite(buzzer,LOW);//Not sound | |
delay(1);// delay 1ms | |
} | |
for(i=0;i<100;i++)// Wen out another frequency sound | |
{ | |
digitalWrite(buzzer,HIGH);// Sound | |
delay(2);//delay 2ms | |
digitalWrite(buzzer,LOW);// Not sound | |
delay(2);//delay 2ms | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment