Go Down

Topic: Led controll through different binary input serially from matlab (Read 740 times) previous topic - next topic

AbdulRafey

I am sending different8 bits binary inputs serially  from matlab such as 00000001,00000010 and 00000011 etc. I just require a code of arduino ide that when i send 00000001 from matlab led 1 blinks and when i send 00000010 led-2 blinks and same for all other binary inputs.
Where led-1 is connected with pin13 and led-2 is connected with pin12 .....

Robin2

Post the program that represents your best attempt and tell us in detail what it actually does and what you want it to do that is different.



Have a look at the examples in Serial Input Basics - simple reliable ways to receive data. There is also a parse example to illustrate how to extract numbers from the received text.

The technique in the 3rd example will be the most reliable. It is what I use for Arduino to Arduino and Arduino to PC communication.

You can send data in a compatible format with code like this (or the equivalent in any other programming language)
Code: [Select]
Serial.print('<'); // start marker
Serial.print(value1);
Serial.print(','); // comma separator
Serial.print(value2);
Serial.println('>'); // end marker


It makes debugging much easier if you send data in human readable form. I would only send binary data if it was the only way to achieve the required performance.

...R
Two or three hours spent thinking and reading documentation solves most programming problems.

Go Up