Пример #1
0
async def main():
    # The connection string for a device should never be stored in code. For the sake of simplicity we're using an environment variable here.
    conn_str = os.getenv("IOTHUB_DEVICE_CONNECTION_STRING")

    # The client object is used to interact with your Azure IoT hub.
    device_client = IoTHubDeviceClient.create_from_connection_string(conn_str)

    # Connect the client.
    await device_client.connect()

    node = cellulariot.CellularIoTApp()
    node.setupGPIO()

    node.disable()
    time.sleep(1)
    node.enable()

    async def sensor_data():
        msg = Message("Acceleration: "+str(node.readAccel())+"; "+"Humidity: " + str(node.readHum())+"; "+"Temperature: " + str(node.readTemp())+"; "+"Lux: " + str(node.readLux())+"; "+"ADC1: " + str(node.readAdc(0))+"; "+"ADC2: " + str(node.readAdc(1))+"; "+"ADC3: " + str(node.readAdc(2))+"; "+"ADC4: " + str(node.readAdc(3)))
        msg.message_id = uuid.uuid4()
        msg.correlation_id = "correlation-1234"
        await device_client.send_message(msg)
    
    count = 0
    while(True):
        await sensor_data()
        print("#"+str(count)+" sent data")
        count = count+1
        time.sleep(1)
Пример #2
0

        
'''
  sensor_test.py - This is basic sensor_test example.
  Created by Yasin Kaya (selengalp), August 28, 2018.
'''

from cellulariot import cellulariot
import time

node = cellulariot.CellularIoTApp()
node.setupGPIO()

node.disable()
time.sleep(1)
node.enable()

time.sleep(0.5)
print("Acceleration: " + str(node.readAccel()))
time.sleep(0.5)
print("Humidity: " + str(node.readHum()))
time.sleep(0.5)
print("Temperature: " + str(node.readTemp()))
time.sleep(0.5)
print("Lux: " + str(node.readLux()))
print("ADC1: " + str(node.readAdc(0)))
time.sleep(0.5)
print("ADC2: " + str(node.readAdc(1)))
time.sleep(0.5)
print("ADC3: " + str(node.readAdc(2)))
time.sleep(0.5)
print("ADC4: " + str(node.readAdc(3)))
time.sleep(0.5)
'''
  sendSMS.py - This is basic SMS Service example.
  Created by Yasin Kaya (selengalp), October 31, 2018.
'''
from cellulariot import cellulariot
import time

#node = cellulariot.CellularIoT() # for Sixfab CellularIoT HAT
node = cellulariot.CellularIoTApp()  # for Sixfab CellularIoT App. Shield
node.setupGPIO()

node.disable()
time.sleep(1)
node.enable()
time.sleep(1)
node.powerUp()

node.sendATComm("ATE1", "OK\r\n")

node.sendSMS("xxxxxxxxxxxxx", "hello world!")
Пример #5
0
def setupNode():
    node = cellulariot.CellularIoTApp()
    node.setupGPIO()
    return node