Hardware Sample Programs
1 Interface Raspberry Pi to LED and write a python program to
simulate the 4 bit shift register repeatedly using the following
Assume initial data to be binary number 1100
If choice=L data should move from left to right
If choice=R data should move from right to left
Display the appropriate message while shifting
2 Interface Raspberry Pi to LED and write a python program to
simulate the 2 bit up/down counter using the following
If choice=U Up-counter
If choice=D Down-counter
Display the appropriate messages while displaying the
counter
3 Interface two LEDs to Raspberry Pi and Write a Python code to
input a number and switch ON the LEDs depending on the
following conditions
Number LED1 LED2
Negative Odd OFF OFF
Negative Even OFF ON
Positive Odd ON OFF
Positive Even ON ON
4 Interface three LEDs to Raspberry Pi and Write a Python code to
simulate the traffic signal repeatedly by assuming the following
Initially signal should be Stop and duration is 5 seconds
Next signal is Go duration is 5 seconds
In between Watch signal of duration 1 seconds
5 Write a python program to reverse the given number without using
predefined function. Check whether the given number is
palindrome or not and display the status on LED by interfacing it to
Raspberry Pi for the following
If the number is palindrome switch on the LED
If the number is not a palindrome switch off the LED
6 Write a python program to read single digit number from the
keyboard and display its binary equivalent by interfacing three
LEDs to Raspberry Pi.
Note: Numbers should be in between 0 to 7
Hardware Sample Programs
7 Interface 3 LEDs to Raspberry Pi and write a program to simulate 3
bit odd/even up-counter. Consider the following for counter display
If choice=O display Odd up-counter i.e 1,3,5,7
If choice=E display Even-counter i.e 0,2,4,6
8 Write a python program to count the number of digits in the input
number and switch on/off the LED based on following condition
by interfacing LED to Raspberry Pi.
If the count is odd switch ON the LED
If the count is even switch OFF the LED
9 Interface 4 LEDs to raspberry Pi and write a python program to
simulate Johnson counter and Ring counter based on the following
conditions
If choice=J display the Johnson counter
If choice =R display the Ring counter
1 Write a python program to input three numbers and find the
0 greatest of three numbers. Interface the 3 LEDs to raspberry Pi and
switch ON the LED based on following
If first number is greater then switch on the first LED
If second number is greater switch ON the second LED
If third number is greater switch ON the third LED