First pi projects

Blinking LED with Raspberry Pi

 

 

Manual LED control

 

Different ways to blink an LED

Using PWM:

A button LED GUI control

 

# Led “Light Show”  Scripting on Raspberry Pi
# Pins are numbered sequentially from the top down in the right
# and left columns for ease of assignment and counting when
# wiring jumpers
from gpiozero import LED
from time import sleep
# Define and assign the leds
redLed = LED(2) # left column pin 2
grnLed = LED(3) # left column pin 3
orngLed = LED(4) # left column pin 4
yelLed = LED(5) # left column pin 15
# repeat code for flashing 4 times
for i in range(4):
redLed.on()
grnLed.on()
orngLed.on()
yelLed.on()
sleep(1)
redLed.off()
grnLed.off()
orngLed.off()
yelLed.off()
sleep(1)
# repeat code for streaming to left 4 times
for i in range(4):
redLed.on()
sleep(0.1)
redLed.off()
grnLed.on()
sleep(0.1)
grnLed.off()
orngLed.on()
sleep(0.1)
orngLed.off()
yelLed.on()
sleep(0.1)
yelLed.off()
# repeat code for streaming to the right 4 times
for i in range(4):
yelLed.on()
sleep(0.1)
yelLed.off()
orngLed.on()
sleep(0.1)
orngLed.off()
grnLed.on()
sleep(0.1)
grnLed.off()
redLed.on()
sleep(0.1)
redLed.off()
# repeat code for alternate pair flashing 4 times
for i in range(4):
redLed.on()
orngLed.on()
sleep(1)
redLed.off()
orngLed.off()
grnLed.on()
yelLed.on()
sleep(1)
grnLed.off()
yelLed.off()

LED SHOW CODE

Choosing which LED to switch on

RPi Python Code for Decimal to 12-Bit Binary LED Visual Display

RGB LED in Raspberry Pi

Tkinter interface

 

Python code for Raspberry Pi LED on/off

Connecting Python Serial and Arduino