Total marks: 40 Time: 120 mins.
Group – A
Set up a system containing 5 LEDs. Your program should loop from 0 to 31 and for each
number in the sequence the LEDs corresponding to the binary digits of the number
should light up. Thus for 17, the LEDs should show 10001, where 1 implies the
corresponding LED is on and a 0 implies the corresponding LED is off.
Group – B (Do only one)
Q. Write a program to simulate the opening and closing of a flood gate by pushing a
joystick. You can assume the flood gate is simulated using a a servo motor. Once the
gate is opened or closed you should display a suitable message on the console of the
form “GATE OPENED AT #####”, where the ### is to be replaced by the time.
Q. You are provided with two arrays Frequencies (in Hz) and Delays (in ms). Your task is
to play the double of each frequency using a buzzer for a duration of 400 times the
corresponding delay. Additionally after playing each note you should have an extra delay
of 100 ms. (Hint: the module time has a function sleep_ms)
Frequencies =
[262,262,294,262,349,330,262,262,294,262,392,349,262,262,524,440,349,330,294,
466, 466,440,349,392,349]
Delays = [1,1,2,2,2,3,1,1,2,2,2,3,1,1,2,2,2,2, 2,1,1,2,2,2,3]
Q. Display two random numbers between 1 to 20 on a LCD display with a delay of 2
seconds between the display of the two numbers. You should then be able to type the
sum of the two numbers using a keypad widget. Finish your entry by pressing #. The LCS
display should then display whether you got the answer right or wrong.
set 3 h mera