Assignment: Buzzer and RGB-LED:

Exercise 1

Write a program for the passive buzzer to buzz using the skeleton below.

define pin number

int main(void){
initialize wiringPi

set pinMode

loop buzzer
{
write High or Low
delay
}

}

Exercise 2

Check the wiringPi software tone library http://wiringpi.com/reference/software-tone-library/ and implement 8 tones on the passive buzzer to light 8 different colors on the RGB-LED.

hint 1 : Assuming when all the RGB are Low, a black light is produced.
R G B
HIGH HIGH HIGH
HIGH HIGH LOW
HIGH LOW HIGH
HIGH LOW LOW
LOW HIGH HIGH
LOW HIGH LOW
LOW LOW HIGH
LOW LOW LOW
hint 2 : You can also implement using the RGB color codes.

Comments

 
Topic revision: r1 - 15 Nov 2018, IsaacArmahMensah