Beispiel #1
0
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)
Beispiel #2
0
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)
Beispiel #3
0
def init(do):
    do.send("C,0\r")  # Continuous mode off
    ok = do.receive()
    print(ok)
    return ok
Beispiel #4
0
#!/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'

Beispiel #5
0
#!/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'
Beispiel #6
0
#!/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'

Beispiel #7
0
#!/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'
Beispiel #8
0
#!/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'
Beispiel #9
0
#!/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)


Beispiel #10
0
#!/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'
Beispiel #11
0
#!/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'

Beispiel #12
0
#!/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'

Beispiel #13
0
#!/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'
Beispiel #14
0
#!/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'
Beispiel #15
0
#!/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'

Beispiel #16
0
def init(do):
  do.send("C,0\r") # Continuous mode off
  ok = do.receive()
  print(ok)
  return ok
Beispiel #17
0
#!/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'

Beispiel #18
0
#!/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'

Beispiel #19
0
#!/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'
Beispiel #20
0
#!/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'


Beispiel #21
0
#!/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'

Beispiel #22
0
#!/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)
Beispiel #23
0
#!/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'

Beispiel #24
0
#!/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'
Beispiel #25
0
#!/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'