def main():
    arduino = get_arduino_pyro()
    storage = get_storage_pyro()
    wait_for_server(logger)

    pin = None
    while pin == None:
        logger.info("Getting pin number by ID")
        pin = storage.get_pin_by_id(PIN_ID)
        logger.info(" + Got pin: %s", pin)
        if pin is None:
            logger.warn(
                " + The pin with ID '%s' was not found... Will retry in 5 secs",
                PIN_ID)
            time.sleep(5)
            continue

    logger.info("Wait until Arduino is connected...")
    while not arduino.is_connected():
        time.sleep(1)

    logger.info("Connected! :-D")

    logger.info("Starting to blink")
    arduino.pinMode(pin.pin, OUTPUT)
    while True:
        arduino.digitalWrite(pin.pin, HIGH)
        time.sleep(1)
        arduino.digitalWrite(pin.pin, LOW)
        time.sleep(1)
def main():
    arduino = get_arduino_pyro()
    storage = get_storage_pyro()
    wait_for_server(logger)

    pin = None
    while pin == None:
        logger.info("Getting pin number by ID")
        pin = storage.get_pin_by_id(PIN_ID)
        logger.info(" + Got pin: %s", pin)
        if pin is None:
            logger.warn(" + The pin with ID '%s' was not found... Will retry in 5 secs", PIN_ID)
            time.sleep(5)
            continue

    logger.info("Wait until Arduino is connected...")
    while not arduino.is_connected():
        time.sleep(1)

    logger.info("Connected! :-D")

    logger.info("Starting to blink")
    arduino.pinMode(pin.pin, OUTPUT)
    while True:
        arduino.digitalWrite(pin.pin, HIGH)
        time.sleep(1)
        arduino.digitalWrite(pin.pin, LOW)
        time.sleep(1)
Пример #3
0
def main():
    arduino = get_arduino_pyro()
    wait_for_server(logger)

    logger.info("Wait until Arduino is connected...")
    while not arduino.is_connected():
        time.sleep(1)

    logger.info("Connected! :-D")

    logger.info("Starting to blink")
    arduino.pinMode(13, OUTPUT)
    while True:
        arduino.digitalWrite(13, HIGH)
        time.sleep(1)
        arduino.digitalWrite(13, LOW)
        time.sleep(1)