Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const int buzzer = 8;
- // the setup function runs once when you press reset or power the board
- void setup() {
- // initialize digital pin LED_BUILTIN as an output.
- pinMode(LED_BUILTIN, OUTPUT);
- pinMode(buzzer,OUTPUT);
- }
- // the loop function runs over and over again forever
- void loop() {
- char a[4];
- char b[3]={'0','4','0'};
- scanf("%c%c%c",&a[0],&a[1],&a[2]);
- for(int j=0;j<3;j++){
- if(a[j]>b[j]){
- for(int i=0;i<30;i++){
- digitalWrite(LED_BUILTIN, HIGH);
- tone(buzzer,1000);
- delay(100); // wait for a second
- digitalWrite(LED_BUILTIN, LOW); // turn the LED off by making the voltage LOW
- tone(buzzer,500);
- delay(100);
- }
- noTone(buzzer);
- break;
- }
- else if(a[j]<b[j]) break;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement