Hello Everyone,
Have not seen much on this subject here in a few years.
(SORRY: How to fix formatting in this post??)
I am helping my Son teach Computer Science at an International School in Guyana, South America. They have good computers and resources and UNO based kits with sensors and actuators. They have advanced well with PYTHON on codeHS.
Now we need to be able to write PYTHON on the PC and interact with Arduino and devices. What have you made work in recent history?
I have PYTHON 3.12 on a WIN10 machine, And Arduino IDE 2.3.3 .
I have compiled Standardfirmata and uploaded it OK to an UNO. I have long Arduino experience and hardware.
I have installed on PC PYTHON: $ pip install pyfirmata without errors.
Using IDLE editor on PC I made a file Try.py:
import pyfirmata
2import time
3
4board = pyfirmata.Arduino('COM5')
5
6while True:
7 board.digital[13].write(1)
8 time.sleep(1)
9 board.digital[13].write(0)
10 time.sleep(1)
-----
When I run that file I get a screen full or red errors. Tried variarions, Updated PyFirmata. Same.
BEFORE I put up screens of errors here, Please tell me if you have a working PC PYTHON to UNO example. Can use any libraries as long as I can get it to work. I need students to be able to use this...
THANKS!
Regards, Terry King
...In The Woods In Vermont
The one who dies with the most Parts LOSES! WHAT DO YOU NEED??
You missed the closing code tag for the code. Hence your last few lines of text are in the code block.
Anything else that you're not happy with?
Be careful with ---; they have a special meaning for the forum software. They either make the text before it a heading (if not mistaken, too lazy to look it up) if you don't separate them from that text using an empty line. Separating them with an empty line gives a thin horizontal line (HTML HR).
When posting python code, you can use ```python as the starting code tag.
It's from a project (not mine!) that uses a Python UI to communicate with an arduino and it ran just fine on Windows 10 the last time I used it about a month ago.
Just search for "serial" and you'll see how the port is configured.