-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
42 lines (32 loc) · 1.05 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#-*- coding:utf-8 -*-
#
# Copyright (c) OPTiM Corporation 2017. All rights reserved.
# Permission to use, copy, modify and redistribute are strongly controlled
# under the rights of OPTiM Corporation.
#
import CiosRaspberryHat
#import SensorPutLed
import sys
import os
import time
from os.path import join, dirname
from dotenv import load_dotenv
if __name__ == '__main__':
url = "wss://api.optim.cloud/v1/messaging"
channel = "LcOZM706G0z4E7Eo1NWvxLsJb8mNpHvCKzOloYZVGS8OLgftST4xTCoMrnQ2ZLD1"
dotenv_path = join(dirname(__file__), '.env')
load_dotenv(dotenv_path)
token = os.environ.get("ACCESS_TOKEN")
cios = CiosRaspberryHat.CiosRaspberryHat(url,channel,token)
#gyro = GyroscopeLed.GyroscopeLed()
message = cios.getSensorData()
#sp = SensorPutLed.SensorPutLed(message)
cios.connection()
LedTime = 0.01
while True:
time.sleep(LedTime)
message = cios.getSensorData()
if message != "error":
#sp.setSensorData(message)
pass
cios.sendMessage(message)