Light LEDs with matlab input data

Hello,

The idea is to send numbers from 1 to 30 to Arduino from Matlab and then light the matching LED. To send the data from Matlab I am using the writeline command, with which I specify the number sent. Then, in Arduino I read that number and light a LED. The problem is that I can only light LEDs from position 1 to 9. From 10th position onwards. the program is only capable of reading one digit. How can I make Arduino to read both digits to light the matching LEDs?

I attaching the Arduino file too.

WavePlotter.ino (3.77 KB)

The serial input basics tutorial shows how to receive serial data.

More members will see your code if posted properly. Read the how get the most out of this forum sticky to see how to properly post code. Remove useless white space and format the code with the IDE autoformat tool (crtl-t or Tools, Auto Format) before posting code in code tags.

@xdelrey - your duplicate post in LEDs and Multiplexing has been deleted

Cross-posting is against the rules of the forum. The reason is that duplicate posts can waste the time of the people trying to help. Someone might spend 15 minutes (or more) writing a detailed answer on this topic, without knowing that someone else already did the same in the other topic.

Repeated cross-posting will result in a timeout from the forum.

In the future, please take some time to pick the forum board that best suits the topic of your question and then only post once to that forum board. This is basic forum etiquette, as explained in the sticky "How to use this forum - please read." post you will find at the top of every forum board. It contains a lot of other useful information. Please read it.

Thanks in advance for your cooperation.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.