Insert matrix with arduino

5 views (last 30 days)
musatche
musatche on 16 Mar 2014
Hello everyone First I want to apologize for my English. I am a student and have a problem. For a study on the BAN (body area network) I would like to communicate an Arduino and Matlab. Arduino via serial port should send multiple values (the values of an accelerometer) separated by tabs (These values between 0 and 1023 are analog inputs of the Arduino). Here is the Arduino code:
if true
const int xpin = A3; // x-axis of the accelerometer
const int ypin = A2; // y-axis
const int zpin = A1; // z-axis (only on 3-axis models)
void setup()
{
Serial.begin(9600); // initialize the serial communications:
}
void loop()
{ // print the sensor values:
Serial.print(analogRead(xpin)); // print a tab between values:
Serial.print("\t");
Serial.print(analogRead(ypin)); // print a tab between values:
Serial.print("\t");
Serial.print(analogRead(zpin));
Serial.println(); // delay before next reading:
delay(100);
}
end
Until the, no problem. I would like Matlab build as matrix as value. With, in the first column the analog value and, in the second, the value of time (the value of time could be send by the arduino by an incrementation, it would be easier). So if I decide to send 5 values with arduino matlab construct me 5 matrix.. Here is my problem, I can already read one value with matlab, but more I can not do ... If you have a solution, let me know!

Answers (0)

Categories

Find more on Arduino Hardware in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!