(pyserial) communicate to arduino through python

Поделиться
HTML-код
  • Опубликовано: 7 янв 2025

Комментарии •

  • @Manuelol
    @Manuelol 3 года назад +6

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

  • @zaureau1583
    @zaureau1583 3 года назад +7

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

  • @anantaatman1845
    @anantaatman1845 4 года назад +5

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

    • @adilmustafa3833
      @adilmustafa3833 4 года назад

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

  • @Jan-mangelinckx
    @Jan-mangelinckx 3 года назад +6

    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.

  • @alexoriginals
    @alexoriginals 4 года назад +2

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

  • @ryanhebron4287
    @ryanhebron4287 3 года назад

    This was exactly what I needed for a project I'm working on. Excellent stuff thanks for posting.

  • @dr7615
    @dr7615 2 года назад

    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...

  • @nejckrajnc9405
    @nejckrajnc9405 2 года назад

    Man! You are really awesome! No1 made such a great tutorial than you

  • @wayneswan3092
    @wayneswan3092 2 года назад

    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!

  • @cortisol_induced_coma
    @cortisol_induced_coma 4 года назад +3

    This worked perfectly, thanks!

  • @11FruitCake11
    @11FruitCake11 4 года назад +4

    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 "
    " appended to the string. serialcomm.readline().decode('ascii')[:-1] can detect the '
    ' in python, without having to wait for the timeout, and the [:-1] strips off the '
    ' leaving you with just the message.
    In a similar manner, change serialcomm.write(i.encode()) to serialcomm.write((i + '
    ').encode()) so that Serial.readStringUntil('
    ') on the arduino detects the '
    ' character without waiting for its timeout.
    Hope this helps.

    • @Jan-mangelinckx
      @Jan-mangelinckx 3 года назад

      made these modification, works perfect and fast. Thanks for this comment. Helps me a lot

  • @workdummy2519
    @workdummy2519 2 года назад

    Thanks a lot for the simple and clear explanation.

  • @WilliamHoward-tf1wl
    @WilliamHoward-tf1wl 4 года назад

    Fantastic. Thanks for using strings rather than single characters.

  • @AbhinavMishraA-wc3ky
    @AbhinavMishraA-wc3ky 3 года назад +1

    Very very helpful for me! Thank you!

  • @livefreeordie5033
    @livefreeordie5033 2 года назад

    Nice and easy lesson😊👍
    Cheers 🇪🇬🌹

  • @tampymacnabb7269
    @tampymacnabb7269 5 лет назад +7

    This is fantastic!!!

  • @baxter6504
    @baxter6504 3 года назад +1

    Good job. Worked like a champ!! 👍

  • @sandiyar007
    @sandiyar007 4 года назад +2

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

    • @TabletopRobotics
      @TabletopRobotics  4 года назад +2

      you technically don't need to, you just need to import the library before you execute any code that call on "serial or time". when you have longer programs its nice to have all your imports on top so you know where they are.

  • @hassan33333333
    @hassan33333333 5 лет назад +1

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

  • @danielhernandezvallecillo2408
    @danielhernandezvallecillo2408 2 года назад

    This is just what I needed, thanks!

  • @vitalimanjur8563
    @vitalimanjur8563 2 года назад

    как пользовать исключение при отсутствие подключение usb порт ардуино? я пытался сделать исключение когда нет устройство Ардуино чтобы сообщили (не подключен устройство) в место ошибки.

  • @alnoorratansi9364
    @alnoorratansi9364 3 года назад +1

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

  • @josphuoc8096
    @josphuoc8096 3 года назад +1

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

  • @anthonynair2878
    @anthonynair2878 4 года назад +1

    which software you have used to create that arduino blinking intially

  • @andresj4353
    @andresj4353 3 года назад

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

  • @fishworxify
    @fishworxify 5 лет назад

    Brilliant!!! Worked perfectly....

  • @mingelklingel8039
    @mingelklingel8039 2 года назад

    is there i library for string?

  • @adipurnama_workshop
    @adipurnama_workshop Год назад

    thank you, very good tutorial

  • @arbaazkhan5868
    @arbaazkhan5868 3 года назад

    # -*- coding: utf-8 -*-
    """
    Created on Mon Feb 22 16:08:09 2021
    @author: Arbaaz
    """
    i used the same code but i get this error
    SerialException: could not open port 'COM3': PermissionError(13, 'Access is denied.', None, 5)

    • @TabletopRobotics
      @TabletopRobotics  3 года назад

      The error usually means that you have another application using the com port. If you have the arduino serial monitor open close it and you can also try changing the com port on your computer.

  • @khaileng3020
    @khaileng3020 2 года назад

    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

    • @TabletopRobotics
      @TabletopRobotics  2 года назад

      Yeah, check out my latest video "How To: Arduino Bluetooth connection to laptop" I think it covers everything you need to know

  • @gowtham-qj7qg
    @gowtham-qj7qg 3 года назад

    is it possible to control a servo using aurduino using the data from the python?

    • @TabletopRobotics
      @TabletopRobotics  3 года назад

      Yes, that's exactly how you can do that :)

    • @gowtham-qj7qg
      @gowtham-qj7qg 3 года назад

      @@badar326 can you please explain little briefly i am a beginner : )

    • @TabletopRobotics
      @TabletopRobotics  3 года назад +1

      @GOWTGHAM P change digitalWrite (LED_BUILTIN,HIGH) to myservo.write(position) if you don't know how to use the servo library, google "Arduino servi.h examples"

  • @edwintoapanta1975
    @edwintoapanta1975 4 года назад

    hi, I have a problem with the function Serial.available(), the codition using serial.available is always false can you help me please

    • @loadedmod
      @loadedmod 4 года назад

      close your arduino serial window before running your python code.

  • @nithinsai2250
    @nithinsai2250 3 года назад

    dude how to send integer input to the arduino?

  • @muhammetbilgic7519
    @muhammetbilgic7519 3 года назад

    How would it work if instead of on and off you wanted to send numbers like 101 or 137

    • @TabletopRobotics
      @TabletopRobotics  3 года назад

      would would send a string variable. Then if you needed you can change the incoming data back into a integer of float.

  • @jonyjohan8958
    @jonyjohan8958 4 года назад

    but i'm using with micropython how i can do it ?

  • @manumohan1928
    @manumohan1928 4 года назад

    thank you man its worked for me thanks a lot

    • @adilmustafa3833
      @adilmustafa3833 4 года назад

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

  • @chinmaykulkarni7835
    @chinmaykulkarni7835 4 года назад

    Why are we using encode?

  • @adilmustafa3833
    @adilmustafa3833 4 года назад

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

  • @khaido1809
    @khaido1809 3 года назад

    Hello every one.
    I Just run my python.
    But when I run program,I recieve a error name "serial has no attribute Serial" pls help me to resolve my problems

    • @silencedmonkeyyy
      @silencedmonkeyyy 2 года назад

      pip uninstall serial
      pip uninstall pyserial
      pip install pyserial

  • @2creativesisters266
    @2creativesisters266 2 года назад

    it works! but my python gives error on off command, im running on vscode

    • @2creativesisters266
      @2creativesisters266 2 года назад

      PortNotOpenError() is raised

    • @TabletopRobotics
      @TabletopRobotics  2 года назад +1

      That error usually means the com port is busy, if you make any other programs using the port close them, else you can try switching com port with device manager.

  • @mbogitechconpts
    @mbogitechconpts 3 года назад

    Great tutorial 👌

  • @raphaellmsousa
    @raphaellmsousa 2 года назад

    Really good! Thanks

  • @toastedbacon1219
    @toastedbacon1219 2 года назад

    underrated

  • @olimail7179
    @olimail7179 3 года назад

    It says no module named serial what to do?

  • @dany241
    @dany241 3 года назад

    Amazing, thank u so much

  • @amankapoor1681
    @amankapoor1681 3 года назад

    nice job its work 👍

  • @nithinsai2250
    @nithinsai2250 3 года назад +1

    it worked nigga

  • @kychemclass5850
    @kychemclass5850 2 года назад

    Great stuff.

  • @MultiChallenger
    @MultiChallenger 2 года назад

    yay thanks

  • @ratmadness4858
    @ratmadness4858 3 года назад

    THANKS!!!!!!!!!!!!!!!!!

  • @cyklop1977
    @cyklop1977 3 дня назад

    Thx

  • @micah6635
    @micah6635 3 года назад

    love ya

  • @CarlosAaronx3
    @CarlosAaronx3 2 года назад

    I LOVE U

  • @mohammadfikriprasetya9825
    @mohammadfikriprasetya9825 2 года назад

    thank

  • @omarpasha9855
    @omarpasha9855 Год назад

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

  • @andrewdok3595
    @andrewdok3595 3 года назад

    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

  • @elfazebook
    @elfazebook 28 дней назад

    thx