Hirdetés

Új hozzászólás Aktív témák

  • asuspc96

    senior tag

    válasz asuspc96 #38188 üzenetére

    ubuntu@ubuntu:~/Documents$ python3 motion_sensor.py 
    van posta
    van posta
    van posta
    van posta
    van posta

    Valóban jobb az érzékelési rátája, viszont még továbbra is elég sok a fals pozitív.
    Szóval nem csinálok semmit, de mégis triggerelődik valamiért... :F

    Nálam most ez a kód fut alatta:
    def detect_motion(self):
    while True:
        self.motion_sensor.wait_for_active()
        if self.motion_sensor.is_active:
            print("Motion detected!")
            break
        self.motion_sensor.wait_for_inactive()
        if not self.motion_sensor.is_active:
            print('waiting...')
            break

    def start_motion_detecting(self):
        while True:
            self.motion_thread.append(
                threading.Thread(
                    target=self.detect_motion,
                    args=()
                )
            )
        for i in range(len(self.motion_thread)):
            self.motion_thread[i].start()
       for i in range(len(self.motion_thread)):
            self.motion_thread[i].join()
        self.motion_thread.clear()

Új hozzászólás Aktív témák