Skip to main content

matlab MatLab connection to arduinoArduino using bluetoothBluetooth

I am attempting to send some information from Matlab,MatLab to an Arduino Uno, via bluetoothBluetooth with the following

matlabMatLab program:

b=Bluetooth('HC-06',1);
fopen(b);
for i=1:1:15                                
 
  fprintf(b,i); 
  out(i) = fscanf(b,'%d');
 
end
fclose(b)

and arduino programArduino program

int matlabval=0;

void setup()  {
    Serial.begin(9600);  
}

void loop() {
    if (Serial.available() > 0) {
    matlabval=Serialmatlabval = Serial.read();
 
    Serial.println(matlabval); 
  
    }
}

the output of arduino is

1 10 2 10 3 10 4 10 5 10 6 10 7 10 8 10 9 10 10 10 11 10 12 10 13 10 14 10 15 10

theThe number 10 is appearappears after each number ?why. Why is that so?

Thanks in advance!

matlab connection to arduino using bluetooth

I am attempting to send some information from Matlab, to an Arduino Uno, via bluetooth with

matlab program

b=Bluetooth('HC-06',1);
fopen(b);
for i=1:1:15                                
 
fprintf(b,i); 
out(i) = fscanf(b,'%d');
 
end
fclose(b)

and arduino program

int matlabval=0;

void setup()  {
    Serial.begin(9600);  
}

void loop() {
    if (Serial.available() > 0) {
    matlabval=Serial.read();
 
    Serial.println(matlabval); 
  
    }
}

the output of arduino is

1 10 2 10 3 10 4 10 5 10 6 10 7 10 8 10 9 10 10 10 11 10 12 10 13 10 14 10 15 10

the number 10 is appear after each number ?why?

Thanks in advance!

MatLab connection to Arduino using Bluetooth

I am attempting to send some information from MatLab to an Arduino Uno via Bluetooth with the following

MatLab program:

b=Bluetooth('HC-06',1);
fopen(b);
for i=1:1:15                                
  fprintf(b,i); 
  out(i) = fscanf(b,'%d');
end
fclose(b)

and Arduino program

int matlabval=0;

void setup()  {
    Serial.begin(9600);  
}

void loop() {
  if (Serial.available() > 0) {
    matlabval = Serial.read();
    Serial.println(matlabval); 
  }
}

the output of arduino is

1 10 2 10 3 10 4 10 5 10 6 10 7 10 8 10 9 10 10 10 11 10 12 10 13 10 14 10 15 10

The number 10 appears after each number. Why is that so?

Thanks in advance!

Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user

I am attempting to send some information from Matlab, to an Arduino Uno, via bluetooth with

matlab program

b=Bluetooth('HC-06',1); fopen(b); for i=1:1:15

fprintf(b,i); out(i) = fscanf(b,'%d');

end fclose(b)

b=Bluetooth('HC-06',1);
fopen(b);
for i=1:1:15                                

fprintf(b,i); 
out(i) = fscanf(b,'%d');

end
fclose(b)

and arduino program

int matlabval=0;

void setup() { Serial.begin(9600); }

void loop() { if (Serial.available() > 0) { matlabval=Serial.read();

Serial.println(matlabval);

int matlabval=0;

void setup()  {
    Serial.begin(9600);  
}

void loop() {
    if (Serial.available() > 0) {
    matlabval=Serial.read();

    Serial.println(matlabval); 
  
    }
}

}

the output of arduino is

1 10 2 10 3 10 4 10 5 10 6 10 7 10 8 10 9 10 10 10 11 10 12 10 13 10 14 10 15 10

the number 10 is appear after each number ?why?

Thanks in advance!

I am attempting to send some information from Matlab, to an Arduino Uno, via bluetooth with

matlab program

b=Bluetooth('HC-06',1); fopen(b); for i=1:1:15

fprintf(b,i); out(i) = fscanf(b,'%d');

end fclose(b)

and arduino program

int matlabval=0;

void setup() { Serial.begin(9600); }

void loop() { if (Serial.available() > 0) { matlabval=Serial.read();

Serial.println(matlabval);

}

}

the output of arduino is

1 10 2 10 3 10 4 10 5 10 6 10 7 10 8 10 9 10 10 10 11 10 12 10 13 10 14 10 15 10

the number 10 is appear after each number ?why?

Thanks in advance!

I am attempting to send some information from Matlab, to an Arduino Uno, via bluetooth with

matlab program

b=Bluetooth('HC-06',1);
fopen(b);
for i=1:1:15                                

fprintf(b,i); 
out(i) = fscanf(b,'%d');

end
fclose(b)

and arduino program

int matlabval=0;

void setup()  {
    Serial.begin(9600);  
}

void loop() {
    if (Serial.available() > 0) {
    matlabval=Serial.read();

    Serial.println(matlabval); 
  
    }
}

the output of arduino is

1 10 2 10 3 10 4 10 5 10 6 10 7 10 8 10 9 10 10 10 11 10 12 10 13 10 14 10 15 10

the number 10 is appear after each number ?why?

Thanks in advance!

Source Link

matlab connection to arduino using bluetooth

I am attempting to send some information from Matlab, to an Arduino Uno, via bluetooth with

matlab program

b=Bluetooth('HC-06',1); fopen(b); for i=1:1:15

fprintf(b,i); out(i) = fscanf(b,'%d');

end fclose(b)

and arduino program

int matlabval=0;

void setup() { Serial.begin(9600); }

void loop() { if (Serial.available() > 0) { matlabval=Serial.read();

Serial.println(matlabval);

}

}

the output of arduino is

1 10 2 10 3 10 4 10 5 10 6 10 7 10 8 10 9 10 10 10 11 10 12 10 13 10 14 10 15 10

the number 10 is appear after each number ?why?

Thanks in advance!