コード例 #1
0
ファイル: do-azure.py プロジェクト: RobBlackwell/do-project
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)
コード例 #2
0
ファイル: do-azure.py プロジェクト: swibowoVL/do-project
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)
コード例 #3
0
ファイル: do-azure.py プロジェクト: swibowoVL/do-project
def init(do):
    do.send("C,0\r")  # Continuous mode off
    ok = do.receive()
    print(ok)
    return ok
コード例 #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'

コード例 #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'
コード例 #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'

コード例 #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'
コード例 #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'
コード例 #9
0
ファイル: do-led.py プロジェクト: RobBlackwell/do-project
#!/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)


コード例 #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'
コード例 #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'

コード例 #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'

コード例 #13
0
ファイル: do-cont-off.py プロジェクト: swibowoVL/do-project
#!/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'
コード例 #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'
コード例 #15
0
ファイル: do-cal.py プロジェクト: RobBlackwell/do-project
#!/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'

コード例 #16
0
ファイル: do-azure.py プロジェクト: RobBlackwell/do-project
def init(do):
  do.send("C,0\r") # Continuous mode off
  ok = do.receive()
  print(ok)
  return ok
コード例 #17
0
ファイル: do-cont.py プロジェクト: RobBlackwell/do-project
#!/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'

コード例 #18
0
ファイル: do-info.py プロジェクト: RobBlackwell/do-project
#!/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'

コード例 #19
0
ファイル: do-status.py プロジェクト: swibowoVL/do-project
#!/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'
コード例 #20
0
ファイル: do-status.py プロジェクト: RobBlackwell/do-project
#!/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'


コード例 #21
0
ファイル: do-reading.py プロジェクト: RobBlackwell/do-project
#!/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'

コード例 #22
0
ファイル: do-led.py プロジェクト: swibowoVL/do-project
#!/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)
コード例 #23
0
ファイル: do-name.py プロジェクト: RobBlackwell/do-project
#!/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'

コード例 #24
0
ファイル: do-cal.py プロジェクト: swibowoVL/do-project
#!/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'
コード例 #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'