Serial Port Timing Issues
Mostra commenti meno recenti
I am trying to establish serial communications between an Arduino and a WIN10 machine. I am using the USB / FTDI arduino connection.
The arduino code is simple-it listens on the serial port, and when ANYthing arrives it simply sends out a phrase. I tested this on a windows serial terminal and it works fine--entering any character returns the phrase. I use the LED on the board to show that data arrived. (see attached zip)
Now, coding the Matlab side, it works sporadically. In the attached code and I show a work around--issue the character to the arduino twice, and wait 2 seconds in between sends. The LED lights both times. Waiting a smaller amout of time generally (but not aways) results in a "Not returned within Timeout" condiiton.
I am expecting that this is some type of timing problem-the MATLAB session is not "listening" in time. I did not see any timing settings in the serialport command. And trying to code a wait on NumBytesAvailable hung matlab as well.
Any ideas appreciated
Fritz
Risposte (1)
Fritz Sonnichsen
il 4 Lug 2022
0 voti
Categorie
Scopri di più su MATLAB Support Package for Arduino Hardware in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!