0% found this document useful (0 votes)
4 views4 pages

Raspberry Pi LED Control Patterns

This Python code defines functions to control the on/off patterns of 8 LEDs connected to a Raspberry Pi by setting their GPIO pin values. It imports the GPIO module, sets the pin modes and defines functions for two LED patterns that are called in a loop.

Uploaded by

wahpashant830
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views4 pages

Raspberry Pi LED Control Patterns

This Python code defines functions to control the on/off patterns of 8 LEDs connected to a Raspberry Pi by setting their GPIO pin values. It imports the GPIO module, sets the pin modes and defines functions for two LED patterns that are called in a loop.

Uploaded by

wahpashant830
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

import Rpi:GPIO as GPIO

import time
[Link]([Link])
led1=29
led2=31
led3=33
led4=35
led5=36
led6=37
led7=38
led8=40
[Link](led1,[Link])
[Link](led2,[Link])
[Link](led3,[Link])
[Link](led4,[Link])
[Link](led5,[Link])
[Link](led6,[Link])
[Link](led7,[Link])
[Link](led8,[Link])
Def ledpattern(ledVal1, ledVal2, ledVal3, ledVal4, ledVal5,
ledVal6, ledVal7, ledVal8):
[Link](led1,ledval1)
[Link](led2,ledval2)
[Link](led3,ledval3)
[Link](led4,ledval4)
[Link](led5,ledval5)
[Link](led6,ledval6)
[Link](led7,ledval7)
[Link](led8,ledval8)
def patternOne():
for I in range(0,3):
ledpattern(1,0,1,0,1,0,1,0)
[Link](1)
ledpattern(1,0,1,0,1,0,1,0)
[Link](1)
def patternTwo():
for I in range(0,5):
ledpattern(1,0,0,0,0,0,0,0)
[Link](0.1)
ledpattern(0,1,0,0,0,0,0,0)
[Link](0.1)
ledpattern(0,0,1,0,0,0,0,0)
[Link](0.1)
ledpattern(0,0,0,1,0,0,0,0)
[Link](0.1)
ledpattern(0,0,0,0,1,0,0,0)
[Link](0.1)
ledpattern(0,0,0,0,0,1,0,0)
[Link](0.1)
ledpattern(0,0,0,0,0,0,1,0)
[Link](0.1)
ledpattern(0,0,0,0,0,0,0,1)
[Link](0.1)
try:
while True:
patternOne()
patternTwo()
finally
[Link]()

You might also like