Python Forum
serial connection to Arduino
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
serial connection to Arduino
#1
Trying to connect pc windows 10 to arduino.
https://pythonforundergradengineers.com/...o-LED.html
But I get this error when using the code examples given.
AttributeError: module 'serial' has no attribute 'Serial'
Reply
#2
It's hard to tell when we don't see the code and the full traceback, but I guess your own file is also named serial.py. Is that the case? Or do you have another file with that name? If yes, rename that file to something different.
In future always post the full traceback you get, in error tags
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply
#3
you may find this of value: https://learn.adafruit.com/arduino-to-circuitpython
Reply
#4
(Oct-21-2021, 09:03 AM)buran Wrote: It's hard to tell when we don't see the code and the full traceback, but I guess your own file is also named serial.py. Is that the case? Or do you have another file with that name? If yes, rename that file to something different.
In future always post the full traceback you get, in error tags

Thank you for your response. The file wasn't called serial.py. I did a search and did find junk left over from something called pyCharm which left some junk after I thought I had removed it. One of the files was serial something html
However today the problem seems to have resolved itself after I did some pip uninstall and pip install of serial and pyserial.
Reply
#5
(Oct-21-2021, 09:47 AM)Larz60+ Wrote: you may find this of value: https://learn.adafruit.com/arduino-to-circuitpython

Thank you for your response.

Yes I have seen that but I am using the Arduino to interface code written for the PC to send and receive data from hardware sensors and actuators. Although not new to programming (at a self taught hobby level) I am new to Python which I figure I have to use or know how to use because much code today is written in Python. I have no problem programming the Arduino in C++.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  pyserial/serial "has no attribute 'Serial' " gowb0w 9 4,066 Aug-24-2023, 07:56 AM
Last Post: gowb0w
Star Pyserial not reading serial.readline fast enough while using AccelStepper on Arduino MartyTinker 4 4,093 Mar-13-2023, 04:02 PM
Last Post: deanhystad
  Serial connection connection issue Joni_Engr 15 8,077 Aug-30-2021, 04:46 PM
Last Post: deanhystad
  Serial loopback with Arduino doesn't work ThomasS 3 2,790 Sep-19-2020, 12:47 PM
Last Post: deanhystad
  Can't transmit serial fast Python to Arduino pyserial mRKlean 0 2,363 Mar-29-2020, 08:12 PM
Last Post: mRKlean
  assign the variable to every value received serial from Arduino barry76 4 3,333 Feb-01-2019, 10:19 AM
Last Post: barry76
  Not receiving serial data from arduino dinoel_cool 4 3,704 Aug-26-2018, 06:16 PM
Last Post: j.crater
  Serial Python and Arduino delfar 7 16,037 Mar-23-2017, 02:23 AM
Last Post: Larz60+
  Serial to Arduino Help Kwebersole 2 3,479 Feb-10-2017, 05:03 AM
Last Post: Kwebersole

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020