Scrambled bluetooth object serial data (arduino to matlab)

2 visualizaciones (últimos 30 días)
Troy Mcan
Troy Mcan el 3 de Jul. de 2018
Respondida: Troy Mcan el 11 de Jul. de 2018
Hi,
My bluetooth serial data from arduino to matlab is totally scrambled (when I test the data over 3rd party bluetooth scanners it looks correct, so it appears matlab is parsing the serial data incorrectly).
The arduino code is simply:
void setup() {
Bluetooth.begin(9600);
Serial.begin(9600);
}
void loop() {
int sensorValue = analogRead(A0);
Serial.println(sensorValue);
Bluetooth.println(sensorValue);
delay(10);
}
My matlab bluetooth object (b) looks like this:
Bluetooth Object : Bluetooth-DSD TECH HC-05:1
Communication Settings
RemoteName: DSD TECH HC-05
RemoteID: btspp://001403066A62
Channel: 1
Terminator: 'CR'
Communication State
Status: open
RecordStatus: off
Read/Write State
TransferStatus: idle
BytesAvailable: 512
ValuesReceived: 5113
ValuesSent: 0
I successfully connect and open:
b = Bluetooth('DSD TECH HC-05',1);
fopen(b);
but I can't read correct values! I've tried:
fscanf fgets fread
any help would be much appreciated!! Thank you in advance!

Respuestas (1)

Troy Mcan
Troy Mcan el 11 de Jul. de 2018
Circling back here- can anyone offer any guidance? Thank you.

Categorías

Más información sobre MATLAB Support Package for Arduino Hardware en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by