thank you in advance.
I will try to keep it short.
I have an Arduino + IDE with a serial port that works fine. I downloaded Python 3.7.2, PySerial, and VPython. Installed all of them.
Installed PySerial through my MacBook terminal.
sudo easy_install pyserial
Password: Searching for pyserial
Best match: pyserial 3.4
Adding pyserial 3.4 to easy-install.pth file
I installed VPython through the terminal too.
MacBook-3:~ myname$ pip list
Package Version
FontTools 2.4
numpy 1.9.1
pip 18.1
Polygon2 2.0.7
pyserial 3.4
setuptools 39.0.1
TTFQuery 1.0.5
VPython 6.11
wxPython 3.0.0.0
wxPython-common 3.0.0.0
and when I typed in help("modules") in the Python 3.7.2 shell I got this, which says PySerial is a module I have.
Please wait a moment while I gather a list of all available modules... PySerial _thread getopt resource YoutubeARDTOPY _threading_local getpass rlcompleter future _tkinter
I made a simple code on Arduino that writes to the serial port, verified and uploaded it. It works fine. Closed that port. Ran this code on Python 3.7.2 expecting this code to grab what is being sent to Arduinos serial port and start posting to Pythons serial port.
import serial #Import Serial Library
arduinoSerialData = serial.Serial('/dev/cu.usbmodem14101', 9600)
while (1==1):
if (arduinoSerialData.inWaiting()>0):
myData = arduinoSerialData.readline()
print (myData.decode())
But I get error messages like this,
=========== RESTART: /Users/donaldlair/Documents/YoutubeARDTOPY.py ===========
Traceback (most recent call last):
File "/Users/donaldlair/Documents/YoutubeARDTOPY.py", line 3, in <module>
arduinoSerialData = serial.Serial('/dev/cu.usbmodem14101', 9600)
AttributeError: module 'serial' has no attribute 'Serial'
So I looked into my dir(serial) folder and this came out (I was told to do this, still not sure why but this might help to figure out.
>>> dir(serial)
['__builtins__', '__cached__', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__path__', '__spec__', 'abc', 'absolute_import', 'division', 'errors', 'generators', 'hooks', 'marshal', 'meta', 'model', 'nested_scopes', 'print_function', 'properties', 'request', 'test', 'unicode_literals', 'utilities', 'with_statement']
Much of these things I just learned for the first time, so if you do answer which I appreciate, please dumb it down a bit as I am somewhat illiterate and a beginner.
Thank you!