Home › Forums › Getting Started › Arduino Programming with Python 3.7
- This topic has 0 replies, 1 voice, and was last updated 5 years, 7 months ago by Anonymous.
-
AuthorPosts
-
March 12, 2019 at 2:02 am #36887AnonymousInactive
Hi there – It would seem as though the Arduino Programmer is written for Python 2.7….. I have gone through and updated alot of the tkMessageBox from Python2.x to the tkinter.messagebox in Python3.x standard
After changing these i then get errors errors when i run the filechooser.py script to do with the way the code handles the serial comms…..
on line 118 <span style=”color: #99cc00;”>arduinoSerialData.write(“do_check_id”)</span> causes this….
error messages:-
**********************************************************************************
File “E:\Program Files\Python\Python37\lib\tkinter\__init__.py”, line 1705, in __call__
return self.func(*args)
File “filechooser.py”, line 118, in check_id_callback
arduinoSerialData.write(“do_check_id”)
File “E:\Program Files\Python\Python37\lib\site-packages\pyserial-3.4-py3.7.egg\serial\serialwin32.py”, line 308, in write
data = to_bytes(data)
File “E:\Program Files\Python\Python37\lib\site-packages\pyserial-3.4-py3.7.egg\serial\serialutil.py”, line 63, in to_bytes
raise TypeError(‘unicode strings are not supported, please encode to bytes: {!r}’.format(seq))
TypeError: unicode strings are not supported, please encode to bytes: ‘do_check_id’*********************************************************************************
Changing to
<span style=”color: #99cc00;”>arduinoSerialData.write(“do_check_id”.encode())</span> sorts this
I had to change all arduinoSerialData.write to include the .encode() statement
When i now press the “Check Device ID”
button i get an endless loop of:-
COM10 – USB-SERIAL CH340 (COM10)
In Check ID function
Using port: COM10I received: do_check_id
Bottom of ReadDeviceID
Before inital pwrapper
Device ID = 01 2B 80 43
I received: do_check_iddo_check_iddo_check_iddo_check_id
I received: do_check_id
Bottom of ReadDeviceID
Before inital pwrapper
Device ID = 01 2B 80 43
I received: do_check_iddo_check_iddo_check_iddo_check_idAs you can see the Device ID is being read ok.
If i send the the ‘do_check_id’ via the serial monitor in the Arduino IDE I get the following return which suggest the Arduino and Fipsy are talking to each other ok.
I received: do_check_id
Bottom of ReadDeviceID
Before inital pwrapper
Device ID = 01 2B 80 43after selecting the Complied Jed file and pressing Program device is get the following where it just repeats ‘Beginning file stream’
/FipsyBaseline_Implementation.jed
In Programming ID
Using port: COM10
Beginning file stream
Beginning file stream
……
Beginning file streamThe LED on the Fipy does go out after pressing this and the Arduino TX and RX led do blink occasionally….
Do you have a Paython3.7 compatible filechooser.py file?? or some pointers as to where things might be going wrong as my debugging skill are nearing their limit??
cheers
-
AuthorPosts
- You must be logged in to reply to this topic.