/* Program pro rizeni blikani na kare dvou paru policejnich svetel bilo modrych doplněné o buzzer zvuk */ int buttonState = 0; int tisk = 0; const int buzzer = 6; //buzzer to arduino pin 6 // the setup function runs once when you press reset or power the board void setup() { pinMode(10,OUTPUT);//blue led pinMode(9,OUTPUT);//white pinMode(3,INPUT);//button input pin pinMode(7,OUTPUT); //on-off led pinMode(buzzer, OUTPUT); // Set buzzer - pin 6 as an output Serial.begin(9600); } void loop() { buttonState = digitalRead(3); digitalWrite(7,HIGH); Serial.println(buttonState, DEC); if (buttonState==HIGH){ for (int i=0;i<1;i++){ tone(buzzer, 1000); // Send 1KHz sound signal... digitalWrite(10, HIGH); // turn the LED on (HIGH is the voltage level) delay(150); // wait digitalWrite(10, LOW); // turn the LED off by making the voltage LOW noTone(buzzer); // Stop sound... delay(50); // wait tone(buzzer, 1350); // Send 1350Hz sound signal... digitalWrite(9, HIGH); // turn the LED on (HIGH is the voltage level) delay(150); // wait digitalWrite(9, LOW); // turn the LED off by making the voltage LOW noTone(buzzer); // Stop sound... delay(50); // wait } } else {} }