Example #1
0
""" Author : Juhi Paliwal and Arunima Mookherjee
    Last Modified : Sat, Apr 16 2016 18:16:46
    MORSE CODE GENERATOR BUILT ON RASPBERRY PI
"""

import time
import RPi.GPIO as GPIO
GPIO.setsmode(GPIO.BOARD)
GPIO.setup(12,GPIO.OUT)
GPIO.cleanup()
on_time=3
on_short_time=1
off_time=1
word=input("Enter the word you wish to display MORSECODE of....")
print(word)
i=0
while i < len(word):
	if word[i] == 'a'
		GPIO.output(12,1)
	    time.sleep(on_short_time)
	    GPIO.output(12,0)
	    time.sleep(off_time)
	    GPIO.output(12,1)
	    time.sleep(on_time)
	    GPIO.output(12,0)
	    return

    elif word[i] == 'b'
	    GPIO.output(12,1)
	    time.sleep(on_time)
	    GPIO.output(12,0)
""" Author : Arunima Mookherjee
    Last Modified : Sat, Apr 16 2016 18:16:46
    MORSE CODE GENERATOR BUILT ON RASPBERRY PI
"""

import time
import RPi.GPIO as GPIO
GPIO.setsmode(GPIO.BOARD)
GPIO.setup(12,GPIO.OUT)
GPIO.cleanup()
on_time=3
on_short_time=1
off_time=1
word=input("Enter the word you wish to display MORSECODE of....")
print(word)
i=0
while i < len(word):
	if word[i] == 'a'
		GPIO.output(12,1)
	    time.sleep(on_short_time)
	    GPIO.output(12,0)
	    time.sleep(off_time)
	    GPIO.output(12,1)
	    time.sleep(on_time)
	    GPIO.output(12,0)
	    return

    elif word[i] == 'b'
	    GPIO.output(12,1)
	    time.sleep(on_time)
	    GPIO.output(12,0)