Ejemplo n.º 1
0
def stop_all():
    linear_push.stop()
    cracker_motor.stop()
    mm_rotate_motor.stop()
    chocolate_motor.stop()
    rotate_base_motor.stop()
    h1.stop()
    pigpio.stop()
Ejemplo n.º 2
0
def main(argv=sys.argv):
    pigpio.stop()
    time.sleep(0.5)
    pigpio.start()

    us = Ultrasonic()
    us.start()

    while True:
        time.sleep(1)
        print "Distance : %.1f" % (us.distance,)

    pigpio.stop()
    return 0
Ejemplo n.º 3
0
    c = t9cb.tally() - oc
    time.sleep(0.1)
    CHECK(9, 2, c, 201, 0, "run script/script status")

    oc = t9cb.tally()
    pigpio.run_script(s, [2000, GPIO])
    while True:
        e, p = pigpio.script_status(s)
        if e != pigpio.PI_SCRIPT_RUNNING:
            break
        if p[9] < 1900:
            pigpio.stop_script(s)
        time.sleep(0.1)
    c = t9cb.tally() - oc
    time.sleep(0.1)
    CHECK(9, 3, c, 110, 10, "run/stop script/script status")

    e = pigpio.delete_script(s)
    CHECK(9, 4, e, 0, 0, "delete script")


if pigpio.start(""):  # must run notification test on localhost
    print("Connected to pigpio daemon.")

    test = [t0, t1, t2, t3, t4, t5, t6, t7, t8, t9]

    for t in test:
        t()

    pigpio.stop()
Ejemplo n.º 4
0
            if self.in_code:

                self.in_code = False

                pigpio.set_watchdog(self.gpio, 0)

                if self.edges > 12:

                    self.callback(self.hash_val)


if __name__ == "__main__":

    import time
    import pigpio
    import ir_hasher

    def callback(hash):
        print("hash={}".format(hash))

    pigpio.start()

    ir = ir_hasher.hasher(7, callback, 5)

    print("ctrl c to exit")

    time.sleep(300)

    pigpio.stop()
Ejemplo n.º 5
0
 def exit(self):
     self.overhead.shutdown()
     self.basking.shutdown()
     pigpio.stop()
Ejemplo n.º 6
0
    def stop_all_devices(self):
        for device in self.devices.values():
            device.stop_device()

        pigpio.stop()
 def stop_all_devices(self):
     for device in self.devices.values():
         device.stop_device()
     
     pigpio.stop()
Ejemplo n.º 8
0
def ctrl_c_handler(signal, frame):
    print 'Cleaning up...'
    pigpio.stop()
    sys.exit(0)
Ejemplo n.º 9
0
def shutdown():
    pigpio.stop()
def main():

    try:
        """ Uncomment if you tested them alone.
        #Stepper Motor: Initialization and adjusting.
        CW = 1     # Clockwise Rotation
        CCW = 0    # Counterclockwise Rotation
        SPR = round(strodLength/ FULLSTEPLENGTH)   # Steps per Revolution
        IO.setup(stepperDir, IO.OUT)
        IO.setup(stepperStep, IO.OUT)
        IO.output(stepperDir, CW)
        #Adjust the step count and dela for you height and design.
        step_count = SPR
        delay = 0.0208
        for x in range(step_count):
            IO.output(stepperStep, True)
            time.sleep(delay)
            IO.output(stepperStep, False)
            time.sleep(delay)
        """
        #Initiate Thermal Sensor:
        omron = OmronD6T()
        #Initiate Uploading to google drive:
        init_logging()
        upload = Upload()
        while True:
            """
                Assuming Robot speed is slow.
            """
            #every 1 second:
            forward()
            time.sleep(1)
            pixelsTemp = [0]*16
            omron.read()
            #print ("ICTemp:",omron.roomTemp)
            for i in range(0,len(omron.temperature)):
                pixelsTemp[i] = omron.temperature[i]
            #Compare Tempratures with THERESHOLD Temperature:
            #Convert From 1D to 2D Array:
            digitalizedPixels = conv2d(compare(pixelsTemp))
            res = maxAreaOfGrid(digitalizedPixels)
            print(res)
            #check if max island of high pixels in 3 or higher:
            if(res > THERESHOLD_PIXELS):
                stop()
                #Check camera to see in this a person:
                detectedPersons = checkPersons()
                if detectedPersons != 0:
                    if detectedPersons > 1:
                        print("Two persons Close to each other")
                    else:
                        print("High Temprature person is detected")
                        # Buzzer On, Relay Active Low
                        IO.output(ALARM_PIN, False)
                        getLocation()
                        #upload._ImageUpload__delete_all_files()
                        upload.check_for_new_images()
                        upload.check_for_new_txt()
                        #Fire Alarm
                        #wait some time
                        time.sleep(1)
                        IO.output(ALARM_PIN, True)

    except KeyboardInterrupt:
        print("\n Ctrl-c Pressed, Stopping and exiting")
    finally:
        pigpio.stop()
Ejemplo n.º 11
0
def cleanup():
    curses.nocbreak()
    curses.echo()
    curses.endwin()
    pigpio.stop()
Ejemplo n.º 12
0
def stop_pigpio(pigpio):
    pigpio.stop()