Pycharm Selfie
Sample interconnection between arduino and pycharm ...
import serial import time import matplotlib.pyplot as grp arduino = serial.Serial('COM#', 9600, timeout=1) time.sleep(2) data = [] for i in range(50): line = arduino.readline() # read a byte
if line: string = line.decode() # convert byte to unicode num = int(string) # convert unicode to interger print(num) data.append(num) # add interger to database arduino.close() # build the plot grp.plot(data) grp.xlabel('Time') grp.ylabel('Sensor Reading') grp.title('Sensor Reading vs.Time') grp.show()
Disclaimer: We shall not be liable for any loss or damage of whatever nature - direct, indirect, consequential, or otherwise - which may arise as a result of your use of any information on this website. However, if you are interested in using any of the projects for personal or educational purposes, please inform the author by email for guidance and technical support.
Public Domain Notice: Copyright (c) 1988. All rights reserved. This article is part of a book entitled Autognorics. Copies are welcome to be shared or distributed publicly as long proper citations are observed. Please cite as follows: Inscription by Design, Joey Lawsin, 1988, USA.
==================================================================
Patent Pending. 2000 © ®
A L.A.W.S.I.N. Educational Production
Comments
Post a Comment