-
-
Save hippyaki/4470c6a1cfcdc069ecf3dacab454188e to your computer and use it in GitHub Desktop.
Arduino - Bolt Tester
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import bolt_conf | |
from boltiot import Bolt | |
import json, time, requests | |
mybolt = Bolt(bolt_conf.API_KEY, bolt_conf.DEVICE_ID) | |
print ("...............") | |
print ("Tester") | |
print ("...............") | |
print(".") | |
print(".") | |
responseA = mybolt.serialBegin('9600') | |
while True: | |
responseB = mybolt.serialRead('10') | |
dataB = json.loads(responseB) | |
print("Sensor value is: " + str(dataB['value'])) | |
print(".") | |
print(".") | |
try: | |
error = str(dataB['value']) | |
if error != 'Command timed out' and len(error) != 0: | |
ret = str(dataB['value']) | |
print("Returned Value " + ret) | |
else: | |
print("Error Occured = " + error) | |
except Exception as e: | |
print ("Error occured: Below are the details") | |
print (e) | |
time.sleep(2) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment