Saturday, February 20, 2016

LED Matrix Project



This is my LED matrix project . Though it is incomplete but you can make it complete by modifying this code below -

import RPi.GPIO as gpio
import time
gpio.cleanup()
input1=int(raw_input('Enter the pin'))
input2=int(raw_input('Enter the another pin no'))
input3=int(raw_input('Enter the third one'))
gpio.setmode(gpio.BOARD)
gpio.setwarnings(False)
led1=input1
led2=input2
led3=input3
gpio.setup(led1,gpio.OUT)
gpio.setup(led2,gpio.OUT)
gpio.setup(led3,gpio.OUT)
for i in range(1000):
   gpio.output(led1,1)
   time.sleep(1)
   gpio.output(led1,0)
   time.sleep(1)
   gpio.output(led2,1)
   time.sleep(1)
   gpio.output(led2,0)
   time.sleep(1)
   gpio.output(led3,1)
   time.sleep(1)
   gpio.output(led3,0)
   time.sleep(1)
gpio.cleanup()

Run the code with root user as sudo. Generally 7,11 and 13 are the gpio pin no which worked for me.

No comments:

Post a Comment

Feautured Post

Python Trivia Post: enumerate()

Python has a very useful inbuilt function, which is called enumerate(). This is needed whenever you need the numbering of a certain element...