Hisfantor's Blog

December 03 2018

Desktop updates:

Workshop PC:

Notebook:

Pi Calendar:

import RPi.GPIO as GPIO 		
#improting the GPIO functions
import time						
#time for pauses between steps

GPIO.setmode(GPIO.BCM)			
#that's the method how to assign the pins
GPIO.setup(24, GPIO.OUT)		
# use the pins as out
GPIO.setup(18, GPIO.OUT)		
#I used the same pins as the calendar

t = 0.5 						
#varable for timing(t in s)

def dot():					
# I used the two LEDs to make a little morse code
# dot/short is the first LED
	GPIO.output(24, GPIO.HIGH)	
	time.sleep(t)
	GPIO.output(24, GPIO.LOW)
	time.sleep(t)

def dash():						
#dash/long is the second LED
	GPIO.output(18, GPIO.HIGH)
	time.sleep(t)
	GPIO.output(18, GPIO.LOW)
	time.sleep(t)

def stop():						
#in between letters both LEDs light up
	GPIO.output(24, GPIO.HIGH)
	GPIO.output(18, GPIO.HIGH)
	time.sleep(t)
	GPIO.output(24, GPIO.LOW)
	GPIO.output(18, GPIO.LOW)
	time.sleep(t)

dot()
dash()
dot()
dash()
stop()

dot()
dot()
stop()

dot()
stop()

#...

GPIO.cleanup()					
#stes back all the GPIO settings and turns everything off