# My Raspberry Pi Valentine
# Raspberry Pi project where LED light signals "I love you" in Morse code
# Video: https://www.youtube.com/watch?v=eNwHuhg6S4s
# Happy Valentine's Day!
# 02/14/2015
import RPi.GPIO as GPIO
import time
led=23
def setup():
GPIO.setmode(GPIO.BOARD)
GPIO.setup(led, GPIO.OUT)
def light(seconds, num=1):
setup()
for i in range(0, num):
GPIO.output(led, True)
time.sleep(seconds)
GPIO.output(led, False)
time.sleep(seconds)
GPIO.cleanup()
def dot():
light(.1)
def dash():
light(1)
# Define alphabet
def signal_a():
dot()
dash()
def signal_b():
dash()
dot()
dot()
dot()
def signal_c():
dash()
dot()
dash()
dot()
def signal_e():
dot()
def signal_f():
dot()
dot()
dash()
dot()
def signal_g():
dash()
dash()
dot()
def signal_h():
dot()
dot()
dot()
dot()
def signal_i():
dot()
dot()
def signal_j():
dot()
dash()
dash()
dash()
def signal_k():
dash()
dot()
dash()
def signal_l():
dot()
dash()
dot()
dot()
def signal_m():
dash()
dash()
def signal_n():
dash()
dot()
def signal_o():
dash()
dash()
dash()
def signal_p():
dot()
dash()
dash()
dot()
def signal_q():
dash()
dash()
dot()
dash()
def signal_r():
dot()
dash()
dot()
def signal_s():
dot()
dot()
dot()
def signal_t():
dash()
def signal_u():
dot()
dot()
dash()
def signal_v():
dot()
dot()
dot()
dash()
def signal_w():
dot()
dash()
dash()
def signal_x():
dash()
dot()
dot()
dash()
def signal_y():
dash()
dot()
dash()
dash()
def signal_z():
dash()
dash()
dot()
dot()
def iloveyou():
#i
signal_i()
#love
signal_l()
signal_o()
signal_v()
signal_e()
#you
signal_y()
signal_o()
signal_u()
iloveyou()
# |
Change |
User |
Description |
Committed |
|
#1
|
11738 |
Liz Lam |
Raspberry Pi project where LED light signals "I love you" in morse code.
Happy Valentine's Day! |
|
|