Hello,
my question is about how to convert the data received from matlab GUI to binary in arduino and then classify it into bits
for example i refer the first 3 bits to (x parameter) for example number 3
and my second three bits to(y parameter )for example number 4
i want the arduino to convert them as
what communications technology are you using to transmit the data from matlab to an arduino, e.g. RS232 serial, WiFi, ?
is the data transfer as binary in 6 bits or a sequence of characters "010100" ?
either wya you should be able to implement a program in C/C++ on the arduino to convert the binary patterns to an integers for processing
horace:
what communications technology are you using to transmit the data from matlab to an arduino, e.g. RS232 serial, WiFi, ?
is the data transfer as binary in 6 bits or a sequence of characters "010100" ?
either wya you should be able to implement a program in C/C++ on the arduino to convert the binary patterns to an integers for processing
an interface package installed in matlab and a library too are used to communicate both together
the data will be transfered to arduino as interger numbers , what i need is that the arduino will convert it to binary
no, i want each received number to be converted to a binary separated from the others
i mean when i receive 1 it should convert it to 001
then 2 be converted to 010 and so on
each is on different and separated bits
horace:
you receive six integer numbers 0 1 0 1 0 0 and you wish to form a single binary value ?
something along the lines of
void setup() {
Serial.begin(9600);
int data[]={0,1,0,1,0,0}; // integer numbers
byte bin=0;
for (int i=0;i<6;i++)
bin = (bin << 1) | data[i];
Serial.println(bin, BIN); // binary value
}
void loop(){}
a run gives
10100
no, i want each received number to be converted to a binary separated from the others
i mean when i receive 1 it should convert it to 001
then 2 be converted to 010 and so on
each is on different and separated bits
TasneemSaad:
sorry but i haven't started yet
i need to know the answer of my question so i can start coding
Do you mean that you have no Matlab program as well as no Arduino program?
If you do have a Matlab program please, as requested, provide some samples of its output. You can probably capture it and display it using the second example in Serial Input Basics. That will also be a useful start for your programming,
If you don't have a Matlab program then give some examples of the data that you would like the Matlab program to send.