veedabowlu
Chirping
Ok, restarted from the beginning... so I got to print "Howdy" great.
What's next?
PyQt5?
Gstreamer?
NGINX web server?
What's next?
PyQt5?
Gstreamer?
NGINX web server?
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
#!/usr/bin/python3
import sys, time, signal
from datetime import datetime
from PyQt5.QtWidgets import QApplication
from PyQt5.QtCore import QTimer
class main():
def __init__(self):
#exit the program when ctrl c is pressed
signal.signal(signal.SIGINT, signal.SIG_DFL)
# Set date on startup
self.today = datetime.today().date()
self.done = False
# Setup the heartbeat timer to run the update function every 100ms
# 1 second has 1000 milliseconds
updateTimer = QTimer()
updateTimer.timeout.connect(self.update)
updateTimer.start(100)
def printMinute(self, m):
print(f'The current even minute is {m}')
def update(self):
# this example shows a way to do something one time when an event happens
minute = datetime.now().minute
# if the remainder of minute / 2 is equal to 0 and self.done is not True
if minute % 2 == 0 and not self.done:
# call the printMinute function and pass the minute to it
self.printMinute(minute)
# now set self.done to True so it only happens once
self.done = True
# else if the remainder of minute / 2 is not equal to 0 set self.done to False
elif minute % 2 != 0:
self.done = False
if __name__ == '__main__':
app = QApplication(sys.argv)
gui = main()
sys.exit(app.exec_())
def openDoor(self): # this is a blocking function
#print('open')
self.doorStatus = 'opening'
print('Opening the Door')
self.startClock = int(monotonic())
gpio.output(DOOR_UP, RUN)
while self.upProx != 1:
self.upProx = self.upProxState.update()
current = int(monotonic())
transitTime = current - self.startClock
self.transitTimeLbl.setText(f'Transit\nTime\n{transitTime}')
self.repaint()
if transitTime > 90:
print('Door is Broken')
self.doorStatus = 'broken'
break
elif self.upProx == 1:
print('Door is Open')
self.doorStatus = 'open'
self.upProxLbl.setText(self.doorState[self.upProx])
self.downProxLbl.setText(self.doorState[self.downProx])
gpio.output(DOOR_UP, STOP)
def closeDoor(self): # this is a non blocking function
# if this is the start of closing get a start time
if self.doorStatus != 'closing':
self.startClock = int(monotonic())
self.doorStatus = 'closing'
print('Closing the Door')
gpio.output(DOOR_DOWN, RUN)
self.downProx = self.downProxState.update()
currentClock = int(monotonic())
transitTime = currentClock - self.startClock
self.transitTimeLbl.setText(f'Transit\nTime\n{transitTime}')
if transitTime > 90:
print('Door is Broken')
# set the door status to broken so it won't keep trying
self.doorStatus = 'broken'
gpio.output(DOOR_DOWN, STOP)
elif self.downProx == 1:
print('Door is Closed')
self.doorStatus = 'closed'
self.downProxLbl.setText(self.doorState[self.downProx])
self.upProxLbl.setText(self.doorState[self.upProx])
gpio.output(DOOR_DOWN, STOP)
# test to see if the door needs to be closed
closeList = ['closed', 'broken']
if not doorOpen and self.doorStatus not in closeList:
self.closeDoor()
if self.doorStatus == 'closed':
print('closeDoor Finished')
@jthornton I click on the zip file,
but i get an "Oops... We're sorry, the page you are looking for could not be found and/or has been moved " what am i doing wrong to see/get the coop3zip file?
sudo apt update
sudo apt dist-upgrade