Page 1
PROJECT Nº 2: Emergency alarm Create a program so that when pressing the button, the LEDs will turn on intermittently following the speed of the sound made by the buzzer, simulating the alarm of an emergency vehicle. DIFFICULTY LEVEL: Beginner. DURATION OF THE EXERCISE: 20 min.
What is a buzzer? A buzzer is an electroacoustic transducer that makes a continuous or intermittent sound, usually treble. It is used as a signaling mechanism o warning and can be applied to multiple systems, such as cars and household appliances, including wake up alarms.
Page 3
Download and install the Arduino IDE program. It is available for Windows, Mac OS and Linux. Open the Arduino program and copy the following program in it: PinSpeedMotorA = 5, PinSpeedMotorB = 6; // PIN DIGITAL PARA LA VELOCIDAD DE LOS MOTORES PinBoton = 11, ValueBoton = 0;...
Page 4
digitalWrite(PinLED1,LOW); // LED1 = OFF digitalWrite(PinLED2,LOW); // LED2 = OFF Configure and upload the code, following the indications on the Code&Drive First Steps guide. Check that the BTL/USB switch on the Build&Code 4in1 board is set to USB, to upload the code correctly. Code for the visual programming software by blocks compatible Download and install the program.
Page 5
Software Configure and upload the code, following the indications on the Code&Drive First Steps guide. Check that the BTL/USB switch on the Build&Code 4in1 board is set to USB, to upload the code correctly. RESULT OF THE EXERCISE When pressing the button, both LEDs will light intermittently. The buzzer will make a sound and change its note every time a LED turns on.