コード例 #1
0
 def get_pid(self):
     if not os.path.exists(self.__pid_path):
         raise "pid file is not found in %s" % self.__pid_path
     pid = commands.getoutput("cat %s" % self.__pid_path)
     if servo.run("ps -p %s" % pid) != 0:
         raise "process with pid=%s not found" % pid
     return pid
コード例 #2
0
ファイル: main.py プロジェクト: GrayGorilla/whosthere
import time
from gpiozero import MotionSensor
from camera import personOrPackage
from notification import sendEmail
from textToSpeech import playGreeting
import servo

pir = MotionSensor("BOARD7")

while True:
    # Detecting Motion
    motion = pir.motion_detected
    if (motion):
        print("Motion Detected")
        fileName, person, package = personOrPackage()
        print("Person present?: ", person)
        print("Package present?: ", package)
        if (person or package):
            sendEmail(fileName, person, package)
            if person:
                # if rooommate:
                playGreeting("Welcome")
                servo.run()
            #else
            #playGreeting("Hello, whats your name")

        time.sleep(10)
    else:
        print("No Motion")
        time.sleep(5)
コード例 #3
0
 def process_exist(self, proc_num):
     return servo.run('ps %d' % proc_num) == 0
コード例 #4
0
 def process_exist(self, proc_num):
     return servo.run('ps %d' % proc_num) == 0