Sending Multiple Pieces of Data through the Serial Port :: Viewer Question #3


Sign up for a free Arduino Short Course for Absolute Beginners

These viewer question videos address questions posted by people like you on watching on YouTube and also for my customers.


Xem Thêm Bài Viết Khác:


  1. my project is sand drawing robot.i want to send pixel array of image to arduino using python.actually i have to send binary image.i have used serial port but it is not showing any useful response.pllzz give me a solution for this.

  2. hello all.

    you have a great channel.

    I have a question hope you can help. I am "new" with the Arduino. and I want to know. if you can send the same message at the same time(or almost) on two different serial ports from the Arduino.

    thank you.

  3. I'm working with an arduino Mega and matlab, I'm sending an array of size 7 (spins wheel 1, 2, 3, time, sense of spin of the wheel 1, 2, 3), then i graph this array on matlab but i want to send back to arduino 3 values of pwm from matlab, can someone help me with this? This is not my main language sory if i commited mistakes

  4. Thanks for your videos, they are great ! I need to do the same but with a second Arduino. If you can do a video on that it will be a lot of help. I can't find tutorials for sending multiple sensor data via serial, Arduino to Arduino.

  5. i am using arduino uno. i am receiving stx04XC34PAM600001etx in serial port. i want to remove stx and etx and display the remaining 15 digit in LCD.kindly support

  6. Hi
    great course!!! can you help me please with softwareSerial ?….I just can't work with nextion display via this lib.
    I'm trying to control relay board via arduino uno …
    Motti Vaknin

  7. sir can i ask something? how can i create a system like i want to register my phone number to gsm module using keywords, then after that my number will be receive message if the sensor trigger. in short my number already registered to the system that will send message if the sensor will trigger. thanks

  8. I need to find a way to capture the oscillation point of a moving object.
    To visualize this, Picture a rail with a distance sensor at each end. The target would oscillate between the 2 end points with the center being 180. To the left the max measurement would be 270 and max 90 to the right. When the target moves to the right then switches direction I want to capture the farthest measurement lowest number serial data to trigger a device when the target is at a certain point on the left. Then I want to capture the oscillation point highest number on the left to in turn trigger the device at a certain point on the right. Due to changing loads on the device being triggered the oscillation points will change randomly.

    Can this be done?

    Below is a rough draft of comments without any code.

    //Arduino uno

    // vl53l0x sensors
    // distance sensor1 value 181 to 270 degrees
    //distance sensor2 value 179 to 90 degrees

    //1 stepper Nemo 17 or 23
    //Stepper full rotation 0-359 steps (clock wise count 0 north)
    //Home 180, max rotation from 270 to 90 degrees.
    // orientations. 270 right, 90 left.
    //sensors placed at the ends of a rail with oscillating target.

    //if sensor1 value oscillates set sensor1 to highvalue of oscillation
    Oscillation at 172-173-172 would set value at 173

    // if sensor2 lowalue is = 178
    // run stepper to 183 when sensor1 reaches 182 //1degrees
    // if sensor2 lowalue is =177
    // run stepper to 184 when sensor1 reaches 183
    // if sensor2 lowalue is =176
    // run stepper to 185 when sensor1 reaches 184
    // if sensor2 lowalue is = 175
    // run stepper to 186 when sensor1 reaches 185
    // if sensor2 lowalue is =174
    // run stepper to 187 when sensor1 reaches 186
    // if sensor2 lowalue is =173
    // run stepper to 188 when sensor1 reaches 187
    // if sensor2 lowalue is = 172
    // run stepper to 189 when sensor1 reaches 188
    // if sensor2 lowalue is =171
    // run stepper to 189 when sensor1 reaches 188
    //Etc……. to lowvalue of 90
    //use < at end max run to 270

    //If sensor 2 value oscillates set sensor2 to lowvalue of oscillation
    Ocilation at 186 – 185 – 186 would set value at 185

    // if sensor1 highvalue is 182
    // run stepper to 177 when sensor2 reaches 178
    // if sensor1 highvalue is 183
    // run stepper to 176 when sensor2 reaches 177
    // if sensor1 highvalue is 184
    // run stepper to 175 when sensor2 reaches 176
    // if sensor1 highvalue is 185
    // run stepper to 174 when sensor2 reaches 175
    //Etc…… highvalue of 270…….
    //use > at end max run to 90.

  9. One of the best Arduino series videos. I haven't taken up the project yet, but I know where to look at for immediate coaching, when I am stalled in any of my project. Please keep on guiding us and keep on building your video library. I already subscribed to your channel.

  10. Hello, thanks for tutorial! I'm looking for help:
    I have a project with arduino uno + barecode reader +RFID tag.
    I want to read this barecode in arduino and send it in the RFID tag . How can i do this?p

  11. The overall explanation was great and the explanation of the Arduino sketch very clear but I am struggling to successfully use Python to write the "Processing" side of the exchange. Any help on doing that would be very welcome.

  12. Thank you so much this was so helpful ! Anyone knows if i can make an array in processing with the values that i get from the sensor ?

  13. Hello, thanks for tutorial! I'm looking for help:
    I have a project with arduino uno + 3 ultrasonic sensors in differents directions.
    I want to read this 3 values independently in arduino and send them in Unity 3d to move 3 different objets. How can i do this?
    Its already working with one sensor, serial port and readline(), but with many values Unity just read all the values like one and move all my 3d objects together. Thanks you community!

  14. Out of pure curiosity, how would one go about reading the serial port off the arduino or any UART to something like a laptop using PuTTY or something like it. I know arduino IDE does this through the software, but thats not my question. My question is actually getting into the down and dirty communication

  15. Why would the serial port have a negative number of bytes? Wouldn't it just be simpler to have something like if(Serial.available() = 0){ }

  16. Hello. I have general issue understanding parsing. I am using example code with some change, and want to transfer 900 bytes from "OpticalFlow", or optical mouse with lens, which has 30×30 pixels (total of 900). So I made this change to the code:
    void serialEvent(Serial cPort)
    comPortString = cPort.readString();
    if (comPortString != null)

    String[] values = split(comPortString,',');
    for ( n=1; n<900; n++) //
    frame[n]= Integer.parseInt(values[n]);
    catch (Exception e) {}
    The question I have is: how to change parsing, so that I do not need ',' separator (coma)? This is because I want higher frame rate for transfer and if one byte is data, next bite is coma separator, then data… it can run twice as faster if there is some way to avoid use of separator. Note that I am using buffer:
    myPort = new Serial(this, Serial.list()[1], 250000);
    This is not my idea, since I am pretty new to this. It just buffer until receiving end of the string, or simbol 'n', whatsoever this is. So far it works good, with exception of wasting half of the time sending coma separator.
    Plese, can you help me solve this problem, because I need all speed possbile over USB. Thank you in advance.

  17. I may watch some of these vids more than once to comprehend the concept, but when I finally get it, the light goes on and my world is illuminated!!
    Thanks again Michael !
    We all appreciate the time and effort you put into these vids to help us along 🙂

  18. Good day. I worked through your video and I understand how to send multiple data. I would like to ask of you if you could please do something like receiving multiple data and storing it in an array? Or can you send me a sample program that can receive 2 integers and store it in an array? Would you please help.

  19. i've done it but i noticed one thing… it doesnt send negative… i want do the same with servo motors in arduino i have  everything perfectly but as i know serial can only receive 0-255 and how can i sand negative?

  20. Thank you for this tutorial! It is super helpful!

    But what if you are receiving multiple values through one sensor, like a 3 axis accelerometer/magnetometer? How would you transmit all these values?

  21. What wild would happen if we just send data using serial.write over and over without worrying about the handshake?
    Thank you

  22. i`ve been searching for a method like this 😀
    thanks so much

    i never thought about arrays i was just sending int values  multiplied by 10 /100/1000/ and so on
    and filtering them using some if conditions 
    thanks so much 🙂

  23. Very stimulating video.
    An interesting thing to do is the ability to determine the loop time, i.e., how much time does it take to complete one cycle for a given baud rate: (read data, send it to PC, get acknowledge signal from PC, repeat ..).
    Thank you.


Please enter your comment!
Please enter your name here