Skip to content

Commit

Permalink
Made the rest also PEP8-compliant
Browse files Browse the repository at this point in the history
  • Loading branch information
Tim van Steenbergen committed Oct 7, 2016
1 parent a59bd56 commit 08708e0
Show file tree
Hide file tree
Showing 17 changed files with 211 additions and 224 deletions.
41 changes: 20 additions & 21 deletions LCD1.py
Expand Up @@ -7,7 +7,7 @@
from time import gmtime, strftime
import os

EMAIL='in06khattab@gmail.com'
EMAIL = 'in06khattab@gmail.com'

GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
Expand All @@ -23,38 +23,37 @@
sleep(1)



def internet_on():
try:
response=urllib2.urlopen('http://www.google.com',timeout=10)
urllib2.urlopen('http://www.google.com', timeout=10)
return True
except urllib2.URLError as err: pass
except urllib2.URLError:
pass
return False



lcd.clear()
if internet_on()==True:
if internet_on():
lcd.message("Internet is set\nup :)")
else:
lcd.message("No internet use\nDoorbell wifi")


while True:
if lcd.buttonPressed(lcd.SELECT): #button pressed
time1=strftime("%l:%M %p on %d-%m-%Y")
message="Ding Dong at "+strftime("%l:%M %p on %d-%m-%Y")
time2=strftime(" %l:%M %p")
if lcd.buttonPressed(lcd.SELECT): # button pressed
time1 = strftime("%l:%M %p on %d-%m-%Y")
message = "Ding Dong at " + strftime("%l:%M %p on %d-%m-%Y")
time2 = strftime(" %l:%M %p")

lcd.clear()
lcd.message("Ding Dong at\n")
lcd.message(strftime("%d-%m-%Y %H:%M:%S"))


os.system("sudo python send_email_fast.py") #put a space within the quote after .py to insert an argument


os.system("sudo python send_email_fast.py") # put a space within the quote after .py to insert an argument

os.system("sudo python tweet.py ")

os.system("sudo python zapier_webhook.py"+ time2) #put a space within the quote after .py to insert an argument
os.system('sudo echo '+message+' | sendxmpp -v -t ' + EMAIL) #send hangouts message


time.sleep(0.2)
os.system(
"sudo python zapier_webhook.py" + time2) # put a space within the quote after .py to insert an argument
os.system('sudo echo ' + message + ' | sendxmpp -v -t ' + EMAIL) # send hangouts message

time.sleep(0.2)
40 changes: 21 additions & 19 deletions LCD2.py
Expand Up @@ -7,7 +7,7 @@
from time import gmtime, strftime
import os

EMAIL='in06khattab@gmail.com'
EMAIL = 'in06khattab@gmail.com'

GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
Expand All @@ -23,37 +23,39 @@
sleep(1)



def internet_on():
try:
response=urllib2.urlopen('http://www.google.com',timeout=10)
urllib2.urlopen('http://www.google.com', timeout=10)
return True
except urllib2.URLError as err: pass
except urllib2.URLError:
pass
return False



lcd.clear()
if internet_on()==True:
if internet_on():
lcd.message("Internet is set\nup :)")
else:
lcd.message("No internet use\nDoorbell wifi")

os.system("./call.sh")
while True:
if lcd.buttonPressed(lcd.SELECT): #button pressed
time1=strftime("%l:%M %p on %d-%m-%Y")
message="Ding Dong at "+strftime("%l:%M %p on %d-%m-%Y")
time2=strftime(" %l:%M %p")
if lcd.buttonPressed(lcd.SELECT): # button pressed
time1 = strftime("%l:%M %p on %d-%m-%Y")
message = "Ding Dong at " + strftime("%l:%M %p on %d-%m-%Y")
time2 = strftime(" %l:%M %p")

lcd.clear()
lcd.message("Ding Dong at\n")
lcd.message(strftime("%d-%m-%Y %H:%M:%S"))
os.system("./call.sh")
os.system("sudo python camera.py")
#os.system("sudo python send_email_fast.py") #put a space within the quote after .py to insert an argument
os.system("sudo python send_email_attachment.py")

os.system("sudo python zapier_webhook.py"+ time2) #put a space within the quote after .py to insert an argument
os.system('sudo echo '+message+' | sendxmpp -v -t ' + EMAIL) #send hangouts message
# os.system("sudo python send_email_fast.py") #put a space within the quote after .py to insert an argument
os.system("sudo python send_email_attachment.py")

os.system(
"sudo python zapier_webhook.py" + time2) # put a space within the quote after .py to insert an argument
os.system('sudo echo ' + message + ' | sendxmpp -v -t ' + EMAIL) # send hangouts message
os.system("sudo python tweet.py ")
time.sleep(0.2)

time.sleep(0.2)
23 changes: 11 additions & 12 deletions LCD_zapier_text.py
Expand Up @@ -21,29 +21,28 @@
sleep(1)



def internet_on():
try:
response=urllib2.urlopen('http://www.google.com',timeout=10)
urllib2.urlopen('http://www.google.com', timeout=10)
return True
except urllib2.URLError as err: pass
except urllib2.URLError:
pass
return False



lcd.clear()
if internet_on()==True:
if internet_on():
lcd.message("Internet is set\nup :)")
else:
lcd.message("No internet use\nDoorbell wifi")


while True:
if GPIO.input(14) == False: #button pressed
if not GPIO.input(14): # button pressed
lcd.clear()
lcd.message("Ding Dong at\n")
lcd.message(strftime("%d-%m-%Y %H:%M:%S"))
os.system("sudo python send_email_fast.py") #put a space within the quote after .py to insert an argument
os.system("sudo python send_email_fast.py") # put a space within the quote after .py to insert an argument
os.system("sudo python tweet.py")
os.system("sudo python zapier_webhook.py") #put a space within the quote after .py to insert an argument


time.sleep(0.2)
os.system("sudo python zapier_webhook.py") # put a space within the quote after .py to insert an argument

time.sleep(0.2)
107 changes: 54 additions & 53 deletions LCDtest_20x4.py
@@ -1,14 +1,14 @@
#!/usr/bin/python

#----------------------------------------------------------------
# ----------------------------------------------------------------
# Author: Chris Crumpacker
# Date: May 2013
#
# A demo of some of the built in helper functions of
# the Adafruit_CharLCDPlate.py This is 20x4 display specific.
#
# Using Adafruit_CharLCD code with the I2C and MCP230xx code aswell
#----------------------------------------------------------------
# ----------------------------------------------------------------

numcolumns = 20
numrows = 4
Expand All @@ -25,132 +25,133 @@
sleep(2)

while True:
#Text on each line alone.
# Text on each line alone.
lcd.clear()
lcd.setCursor(0,0)
lcd.setCursor(0, 0)
lcd.message("Line 1")
sleep(1)

lcd.clear()
lcd.setCursor(0,1)
lcd.setCursor(0, 1)
lcd.message("Line 2")
sleep(1)

lcd.clear()
lcd.setCursor(0,2)
lcd.setCursor(0, 2)
lcd.message("Line 3")
sleep(1)

lcd.clear()
lcd.setCursor(0,3)
lcd.setCursor(0, 3)
lcd.message("Line 4")
sleep(1)

# Using the "\n" new line marker
lcd.clear()
lcd.setCursor(0,0)
lcd.setCursor(0, 0)
lcd.message("Line 1")
sleep(1)

lcd.clear()
lcd.setCursor(0,0)
lcd.setCursor(0, 0)
lcd.message("Line 1\nLine 2")
sleep(1)

lcd.clear()
lcd.setCursor(0,0)
lcd.setCursor(0, 0)
lcd.message("Line 1\nLine 2\nLine 3")
sleep(1)

lcd.clear()
lcd.setCursor(0,0)
lcd.setCursor(0, 0)
lcd.message("Line 1\nLine 2\nLine 3\nLine 4")
sleep(1)

# Auto line limiting by length as to not overflow the display
# This is line by line and does not to any caraige returns
lcd.clear()
lcd.setCursor(0,0)
lcd.setCursor(0, 0)
lcd.message("This String is 33 Characters long", lcd.TRUNCATE)
sleep(2)
sleep(2)

lcd.clear()
lcd.setCursor(0,0)
lcd.setCursor(0, 0)
lcd.message("This String has ellipsis", lcd.TRUNCATE_ELLIPSIS)
sleep(2)
#Scroll text to the right
sleep(2)

# Scroll text to the right
messageToPrint = "Scrolling Right"
i=0
while i<20:
i = 0
while i < 20:
lcd.clear()
lcd.setCursor(0,0)
lcd.setCursor(0, 0)
suffix = " " * i
lcd.message(suffix + messageToPrint, lcd.TRUNCATE)
sleep(.25)
i += 1

# Scroll test in from the Left
messageToPrint = "Scrolling Left"
i=20
while i>=0:
i = 20
while i >= 0:
lcd.clear()
lcd.setCursor(0,0)
lcd.setCursor(0, 0)
suffix = " " * i
lcd.message(suffix + messageToPrint, lcd.TRUNCATE)
sleep(.25)
i -= 1
sleep(2)
sleep(2)

# Printing text backwards, NOT right justified
lcd.clear()
lcd.setCursor(0,0)
lcd.setCursor(0, 0)
lcd.message("Right to left:")
lcd.setCursor(10,1)
lcd.setCursor(10, 1)
lcd.rightToLeft()
lcd.message("Testing")
sleep(2)

# Printing normally from the middle of the line
lcd.clear()
lcd.setCursor(0,0)
lcd.setCursor(0, 0)
lcd.message("Left to Right:")
lcd.setCursor(10,1)
lcd.setCursor(10, 1)
lcd.message("Testing")
sleep(2)

# Enabling the cursor and having it blink
lcd.clear()
lcd.setCursor(0,0)
lcd.setCursor(0, 0)
lcd.cursor()
lcd.blink()
lcd.message("Cursor is blinking")
lcd.setCursor(0,1)
lcd.setCursor(0, 1)
sleep(3)
lcd.noCursor()
lcd.noBlink()

# Turning the backlight off and showing a simple count down
lcd.clear()
lcd.setCursor(0,0)
lcd.setCursor(0, 0)
lcd.message("Backlight off in")
lcd.setCursor(0,3)
lcd.setCursor(0, 3)
lcd.message("Back on in 3sec")
lcd.setCursor(17,0) #Reseting the cursor here keeps us from having to clear the screen, this over writes the previous character
lcd.setCursor(17, 0)
# Reseting the cursor here keeps us from having to clear the screen, this over writes the previous character
lcd.message("3")
sleep(1)
lcd.setCursor(17,0)

lcd.setCursor(17, 0)
lcd.message("2")
sleep(1)
lcd.setCursor(17,0)

lcd.setCursor(17, 0)
lcd.message("1")
sleep(1)

lcd.backlight(lcd.OFF)
lcd.clear()
lcd.setCursor(0,0)
lcd.setCursor(0, 0)
sleep(3)
lcd.backlight(lcd.ON)
lcd.message("Backlight on")

0 comments on commit 08708e0

Please sign in to comment.