Ejemplo n.º 1
0
def init_qwiic():
    global prox, bme, ccs, oled
    # Qwiic Board define
    prox = qwiic.QwiicProximity()
    bme = qwiic.QwiicBme280()
    ccs = qwiic.QwiicCcs811()
    oled = qwiic.QwiicMicroOled()

    # Begin statements
    prox.begin()
    bme.begin()
    #ccs.begin()
    oled.begin()

    # Used for debugging CCS811
    try:
        ccs.begin()

    except Exception as e:
        print(e)

    # Setup OLED
    oled.clear(oled.ALL)
    oled.display()
    oled.set_font_type(1)
Ejemplo n.º 2
0
def init_qwiic():
    global prox, bme, ccs, oled
    # Qwiic Board define
    # prox = qwiic.QwiicProximity()
    bme = qwiic.QwiicBme280()
    ccs = qwiic.QwiicCcs811()
    # oled = qwiic.QwiicMicroOled()

    # Begin statements
    # prox.begin()
    bme.begin()
    #ccs.begin()
    # oled.begin()

    # Used for debugging CCS811
    try:
        ccs.begin()

    except Exception as e:
        print(e)
Ejemplo n.º 3
0
def on_log(mqttc, obj, level, string):
    print(string)


mqttclient = mqtt.Client()
mqttclient.on_log = on_log
mqttclient.on_connect = on_connect
mqttclient.on_message = on_message
mqttclient.on_publish = on_publish
mqttclient.username_pw_set("device", password="******")
mqttclient.loop_start()
mqttclient.connect("insert-fqdn-of-server-here", 3883, 60)

CCS811 = qwiic.QwiicCcs811()
BME280 = qwiic.QwiicBme280()

CCS811.begin()
BME280.begin()

coordinates = gps.getCoordinates()
latitude = coordinates[0]
longitude = coordinates[1]

tags = {
    # TODO set the device ID to be a unique ID
    "deviceId": "device-123",
    "latitude": latitude,
    "longitude": longitude,
    "synced": False,
}
Ejemplo n.º 4
0
initialize=True
n=2

#MQTT Cayenne setup - you will need your own username, password and clientid
#To setup a Cayenne account go to https://mydevices.com/cayenne/signup/
username = "******"
password = "******"
clientid = "___ENTER_CAYENNE_CLIENTE_ID___"
mqttc=mqtt.Client(client_id = clientid)
mqttc.username_pw_set(username, password = password)
mqttc.connect("mqtt.mydevices.com", port=1883, keepalive=60)
mqttc.loop_start()

#Qwiic Board define
prox = qwiic.QwiicProximity()
bme = qwiic.QwiicBme280()
ccs = qwiic.QwiicCcs811()
#oled = qwiic.QwiicMicroOled()

#Begin statements
prox.begin()
bme.begin()
#ccs.begin()
#oled.begin()

#Used for debugging CCS811
try:
    ccs.begin()

except Exception as e:
    print(e)