Scrambled bluetooth object serial data (arduino to matlab)
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Réponses (1)
Voir également
Catégories
En savoir plus sur MATLAB Support Package for Arduino Hardware dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!