Vous êtes sur la page 1sur 14

Exercise 1.

Program
Output:

Brief Description:

The program is about to turn on the LEDs based on the sequence given to me. There are 3 sequences all
in all. The 8 LEDs are at pin 11, 12, 13, 54, 55, 56, 57, and 58. I need to set-up the program. The command
I used for setup is pinMode for the LED output. Then for the looping I used digitalWrite for turning on the
command is HIGH and for turning off the command is LOW. I used those commands to perform the
sequences given to me.
Exercise 1.2

Program
Output

Brief Description

Exercise No. 2 used two switches as an input and 8 LEDs as an output. Switch 1 indicate as SW1 at pin 2
and Switch 2 indicate as SW2 at pin 3. The 8 LEDs are at pin 11, 12, 13, 54, 55, 56, 57, and 58. When SW1
is pressed, the output display will be sequence 1. When SW2 is pressed, the output display will be
sequence 2. When both SW1 and SW2 are pressed, the output display will be sequence 3. Else, there is
no output display.
Exercise no.3

Program
Output:

Brief Description

For this exercise, we will be using the RGB Led built on the training shield. Its pins are 5, 6 and 9. As the
procedure says, we'll be using more than 3 colors on the RGB LED. So for this instance, we'll be using the
colour setting of certain color which can be found on Microsoft word. Also, with the help of Serial monitor,
we'll be able to change the color of the RGB LED in the software.
Exercise 4

Program
Output:

Brief Description:

Exercise number 4 uses an RGB LED and two switches. The switch controls the color of the output of the
RGB LED. When switch 1 is pressed, the output on the LED is color Violet. When switch 2 is pressed, the
output is color Orange. When both switches 1 and 2 are pressed, the RGB LED emits a Yellow color but
when neither of the switches are pressed, the LED emits a Black color, but in actual, the RGB is simply
turned off.
Exercise 5

Program

Brief Description:

Exercise number 5 uses a buzzer and 2 switches. The buzzer can emit sound of different frequencies, for
this number the outputs will be 400 Hz, 1500 Hz, and 3000Hz. When switch 1 is pressed the buzzer plays
a 400 Hz tone for 4 seconds, this tone is not irritable to hear because of its low intensity. When switch 2
is pressed a 1500 Hz tone plays for 3 seconds, this tone is slightly irritable because of its slightly intense
sound. And when both switches 1 and 2 are pressed the buzzer plays a 3000 Hz tone for 1 second, this
sound has a high intensity so it is irritable to hear for a long time.
Exercise 6
Brief Description:

Exercise 6 used serial character as an input and buzzer as an output. The buzzer is located at pin 4.
Compiler directives #include pitches.h is used because it contains all the pitch values. Through serial
monitor, when we input H, the Happy Birthday tone play. When we input A, the Lullaby tone play. When
we input S, the Twinkle Little Star tone play.

Vous aimerez peut-être aussi