I'm writing a project in python which should eventually running on LinkIt One IoT device.
I've written some test code to check whether I am able to connect between Arduino IDE to python (I am working with Pycharm).
the test code is:
import serial
import time
arduino = serial.Serial('COM1', 115200, timeout=.1)
time.sleep(1) #give the connection a second to settle
arduino.write("Hello from Python!")
while True:
data = arduino.readline()
if data:
print data.rstrip('\n')
when I am running to code I am getting:
C:\Users\אורי\PycharmProjects\untitled\venv\Scripts\python.exe C:/Users/אורי/PycharmProjects/untitled2/test.py
Traceback (most recent call last): File "C:/Users/����/PycharmProjects/untitled2/test.py", line 1, in import serial ImportError: No module named serial
how did you install your serial module? If you want to make sure It will be detected, go into your console
pip install serial
and run your code from the console too
python test.py # make sure your console is in the right folder path
or
find where the module is installed, something like "C:\Python27\Lib\site-packages"
import sys
sys.path.append("C:\Python27\Lib\site-packages") # this is where python stores modules, yours could be different
import serial
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With