def main(): # Connect to IOT Hub device = DeviceClient.DeviceClient(config.HUB, config.DEVICE_NAME, config.KEY) # Connect to the Atlas Scientific DO circuit board do.connect() ok = init(do) while ok != '*OK': ok = init(do) while True: do.send("R\r") # Request a value for DO r = do.receive() print(r) ok = do.receive() print(ok) assert ok == '*OK' msg = "{ \"deviceId\" : \"" + config.DEVICE_NAME + "\", \"do\" : \"" + r + "\"" + ", \"at\" : \"" + str(datetime.now()) + "\"}" print(msg) try: device.create_sas(600) # Shared Access Signature used for authentication print(device.send(bytes(msg,'utf-8'))) except Exception as err: print(err) time.sleep(SLEEP)
def main(): # Connect to IOT Hub device = DeviceClient.DeviceClient(config.HUB, config.DEVICE_NAME, config.KEY) # Connect to the Atlas Scientific DO circuit board do.connect() ok = init(do) while ok != '*OK': ok = init(do) while True: do.send("R\r") # Request a value for DO r = do.receive() print(r) ok = do.receive() print(ok) assert ok == '*OK' msg = "{ \"deviceId\" : \"" + config.DEVICE_NAME + "\", \"do\" : \"" + r + "\"" + ", \"at\" : \"" + str( datetime.now()) + "\"}" print(msg) try: device.create_sas( 600) # Shared Access Signature used for authentication print(device.send(bytes(msg, 'utf-8'))) except Exception as err: print(err) time.sleep(SLEEP)
def init(do): do.send("C,0\r") # Continuous mode off ok = do.receive() print(ok) return ok
#!/usr/bin/env python3 import do do.VERBOSE = True # Connect to the Atlas Scientific DO circuit board do.connect() do.send("S,?\r") do.receive() ok = do.receive() assert ok == '*OK'
#!/usr/bin/env python3 import do do.VERBOSE = True # Connect to the Atlas Scientific DO circuit board do.connect() do.send("C,1\r") ok = do.receive() assert ok == '*OK'
#!/usr/bin/env python3 import do do.VERBOSE = True # Connect to the Atlas Scientific DO circuit board do.connect() do.send("T,?\r") do.receive() ok = do.receive() assert ok == '*OK'
#!/usr/bin/env python3 import do do.VERBOSE = True # Connect to the Atlas Scientific DO circuit board do.connect() do.send("I\r") do.receive() ok = do.receive() assert ok == '*OK'
#!/usr/bin/env python3 import do do.VERBOSE = True # Connect to the Atlas Scientific DO circuit board do.connect() do.send("R\r") do.receive() ok = do.receive() assert ok == '*OK'
#!/usr/bin/env python3 import do import time do.VERBOSE = True # Connect to the Atlas Scientific DO circuit board do.connect() while True: do.send("L,1\r") ok = do.receive() assert ok == '*OK' time.sleep(3) do.send("L,0\r") ok = do.receive() assert ok == '*OK' time.sleep(1)
#!/usr/bin/env python3 import do do.VERBOSE = True # Connect to the Atlas Scientific DO circuit board do.connect() do.send("P,?\r") do.receive() ok = do.receive() assert ok == '*OK'
#!/usr/bin/env python3 import do do.VERBOSE = True # Connect to the Atlas Scientific DO circuit board do.connect() do.send("C,0\r") ok = do.receive() assert ok == '*OK'
#!/usr/bin/env python3 import do do.VERBOSE = True # Connect to the Atlas Scientific DO circuit board do.connect() do.send("NAME,?\r") do.receive() ok = do.receive() assert ok == '*OK'
#!/usr/bin/env python3 import do do.VERBOSE = True # Connect to the Atlas Scientific DO circuit board do.connect() do.send("Cal\r") ok = do.receive() assert ok == '*OK'
#!/usr/bin/env python3 import do do.VERBOSE = True # Connect to the Atlas Scientific DO circuit board do.connect() do.send("STATUS\r") do.receive() ok = do.receive() assert ok == '*OK'