Connecting arduino to matlab via BT while using I2C communication
Mostrar comentarios más antiguos
I am currently on a project trying to send data from arduino to matlab. I have one arduino uno (master) that is recieving data from arduino uno (slave) and another board via I2C. Once the master gets that date I want it to send the data to matlab via BT HC05 connection. To start this procces I use the next code (this is the simplest version):
arduinoObj = serialport('COM4',9600);
pause(3);
flush(arduinoObj);
writeline(arduinoObj,'1');
arduinoObj.NumBytesWritten;
pause(1);
if arduinoObj.NumBytesAvailable>0
arduinoObj.NumBytesAvailable
x = readline(arduinoObj);
end
The problem is that the writeline command sometimes works and sometimes does not. With just an arduino, the board with I2C and de BT HC05 it works, the problem starts when adding a second arduino.
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Arduino Hardware en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!