Scrambled bluetooth object serial data (arduino to matlab)
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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!
0 Kommentare
Antworten (1)
Siehe auch
Kategorien
Mehr zu MATLAB Support Package for Arduino Hardware finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!