Ejemplo n.º 1
0
def run_server():
    log.info('run_server')

    thing = make_thing()

    # If adding more than one thing, use MultipleThings() with a name.
    # In the single thing case, the thing's name will be broadcast.
    server = WebThingServer(SingleThing(thing), port=80)
    try:
        log.info('starting the server')
        server.start()
    except KeyboardInterrupt:
        log.info('stopping the server')
        server.stop()
        log.info('done')
def run_server():
    log.info("run_server")

    rgb = RGBLed(0, 2, 4)

    # If adding more than one thing here, be sure to set the `name`
    # parameter to some string, which will be broadcast via mDNS.
    # In the single thing case, the thing's name will be broadcast.
    server = WebThingServer(SingleThing(rgb), port=80)
    try:
        log.info("starting the server")
        server.start()
    except KeyboardInterrupt:
        log.info("stopping the server")
        server.stop()
        log.info("done")
Ejemplo n.º 3
0
def run_server():
    log.info("run_server")

    led = Led(5, 0)

    server = WebThingServer(led, "SparkFun-ESP32-Thing", port=80)
    try:
        log.info("starting the server")
        server.start()
    except KeyboardInterrupt:
        log.info("stopping the server")
        server.stop()
        log.info("done")

    while True:
        time.sleep(0.1)
        button.process()
Ejemplo n.º 4
0
def run_server():
    print('run_server')

    # Create a thing that represents a pycom
    pycom = PycomThing()

    # Create a thing that represents a pysense
    pysense = PySenseThing()

    # If adding more than one thing, use MultipleThings() with a name.
    # In the single thing case, the thing's name will be broadcast.
    server = WebThingServer(MultipleThings([pycom, pysense],
                                           'PycomAndPySense'),
                            port=80)
    try:
        print('starting the server')
        server.start()
    except KeyboardInterrupt:
        print('stopping the server')
        server.stop()
        print('done')
def run_server():
    log.info('run_server')

    # Create a thing that represents a dimmable light
    light = ExampleDimmableLight()

    # Create a thing that represents a humidity sensor
    sensor = FakeGpioHumiditySensor()

    # If adding more than one thing, use MultipleThings() with a name.
    # In the single thing case, the thing's name will be broadcast.
    server = WebThingServer(MultipleThings([light, sensor],
                                           'LightAndTempDevice'),
                            port=80)
    try:
        log.info('starting the server')
        server.start()
    except KeyboardInterrupt:
        log.info('stopping the server')
        server.stop()
        log.info('done')
def run_server():
    log.info('run_server')

    led = Led(5)
    button = Button(0)

    # If adding more than one thing here, be sure to set the `name`
    # parameter to some string, which will be broadcast via mDNS.
    # In the single thing case, the thing's name will be broadcast.
    server = WebThingServer(MultipleThings([led, button],
                                           'SparkFun-ESP32-Thing'),
                            port=80)
    try:
        log.info('starting the server')
        server.start()
    except KeyboardInterrupt:
        log.info('stopping the server')
        server.stop()
        log.info('done')

    while True:
        time.sleep(0.1)
        button.process()