Commit 56f5c907 authored by Shrishailya Agashe's avatar Shrishailya Agashe
Browse files

Upload New File

parent f6836de0
# This code accepts incoming string from the COM Port, Parses the JSON String and converts it into a dictionary.
# The final dictionary object JSONDict is created.
# I have simply printed the dictionary here.
# The code can be modified to do required opeartions on the dictionary.
# - Shrishailya Agashe
import json
import serial
#replace this with the comport of your arduino
comport = 'COM3'
#initialize the serial object
myArduino = serial.Serial(port = comport, baudrate = 115200, timeout=1)
#infinite loop that checks continuously for incoming JSON string
while True:
try:
incoming_stream = myArduino.readline()
#incoming_stream = incoming_stream.decode('utf-8')
incoming_stream = incoming_stream.strip()
print(incoming_stream)
except:
print("keyboard Interrupt")
break
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment