Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int spin = 4; //speaker pin
- void alarm(){
- for(int hz = 440; hz < 1000; hz++){
- tone(spin, hz, 50);
- delay(1);
- }
- noTone(spin);
- for(int hz = 1000; hz > 440; hz--){
- tone(spin, hz, 50);
- delay(1);
- }
- noTone(spin);
- }
- void setup() {
- // put your setup code here, to run once:
- pinMode(spin,OUTPUT); //beeper
- pinMode(5,OUTPUT); //sw
- digitalWrite(5,HIGH);
- alarm();
- alarm();
- digitalWrite(5,LOW);
- }
- void loop() {
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement