(pyserial) communicate to arduino through python

preview_player
Показать описание
Today I'm going to show you guys how to get your computer to communicate with and arduino through a serial port using python.
I'm using an clone of an arduino mega but this should work with any arduino compatible boards.

If you are having problems with the communications things you should try:
-make sure everything is plunged in correctly
-make sure thee Com port and baud rate are the same
-make sure no other program is using the same COM port

I did not make this python module and you can find how to download the module by following this link.

software I used to make/edit this video
-open camera
-python
-arduino
-free cam
-tupitube
-shotcut
Рекомендации по теме
Комментарии
Автор

I have been watching videos on this for hours. Idk why but with your code it's finally working. Thank you so much!!!!

Manuelol
Автор

Thanks for the video.. I have applied this to Arduino Nano and switched from Python3.8 and it's working perfectly.

anantaatman
Автор

Thanks a lot.
I had tried to use another codes and nothing worked in my 3.8 python.
You helped me a lot. Thanks

alexoriginals
Автор

Fantastic tutorial. Quick, clear, to the point. Worked perfectly. Thank you so much!

zaureau
Автор

Great tutorial. First one that really works and makes sense. There is a lot off crap on the internet about this topic, but this thing does what it supposed to do. Thanks again men.

Jan-mangelinckx
Автор

FINALLY! Someone who actually knows what they're doing and can relay it to others well! Thank You!
NOW, can you do a video on operating a camera pan/tilt on arduino from python? cause I can't find a good one anywhere!

wayneswan
Автор

This code works well but doesn't allow you to send commands in quick succession. This is what I did to speed things up:
If you change the arduino code to send data using Serial.println() instead of Serial.write(), it will send termination characters "\r\n" appended to the string. can detect the '\n' in python, without having to wait for the timeout, and the [:-1] strips off the '\r' leaving you with just the message.
In a similar manner, change serialcomm.write(i.encode()) to serialcomm.write((i + '\n').encode()) so that Serial.readStringUntil('\n') on the arduino detects the '\n' character without waiting for its timeout.
Hope this helps.

FruitCake
Автор

Thanks a lot for the simple and clear explanation.

workdummy
Автор

I like video for "how to use serial in Python". BUT is is so stupid don't check what you send to Arduino. Of course Arduino should check what it get from "stupid human", but also Python script too should do the same chrck before sending message. In other way there IS stupid human

andrewdok
Автор

Great Video, can you do video/code on saving a hex file that arduino reads form a external Eprom or simulation.

alnoorratansi
Автор

Why we need to import serial or time 1st, I am sorry if it's a silly question.

sandiyar
Автор

Thank you man..Am using esp32 when run the code on esp32 ....
Python script doesn't work .. it seems like they dont work together

hassan
Автор

You gave no information on how to set up pyserial! Stop playing around!

omarpasha
Автор

Great video! Can you do more about motor control? thanks

josphuoc
Автор

Hi, how to read data from arduino to laptop via bluetooth with python, and it is wireless which means no usb connection between arduino and laptop

khaileng
Автор

which software you have used to create that arduino blinking intially

anthonynair
Автор

thank you man its worked for me thanks a lot

manumohan
Автор

I dont really understan when exactly he connect python with arduino. is it with serial? how come?

andresj
Автор

I am facing some issues "raise PortNotOpenError()" can anyone help me with it?

adilmustafa
Автор

I did get this to work... thank you for sharing this vid. I did have to add a delay of 100 ms in the while of Arduino sketch, because it would randomly send the "Invalid Entry", otherwise. I am using spyder in Anaconda, and it is much easier to get the necessary pyserial files installed through the Anaconda Navagator...

dr