rwaldron / johnny-five

JavaScript Robotics and IoT programming framework, developed at Bocoup.
http://johnny-five.io
Other
13.3k stars 1.77k forks source link

Not able to send / Receive data using HC-05 Bluetooth module #1069

Closed sarkarstanmoy closed 6 years ago

sarkarstanmoy commented 8 years ago

Hi,

I have followed https://github.com/rwaldron/johnny-five/wiki/Getting-Started-with-Johnny-Five-and-HC-05-Bluetooth-Serial-Port-Module and able to configure bluetooth module. I have also followed node-serial https://github.com/voodootikigod/node-serialport and use below code


var SerialPort = require("serialport").SerialPort
var serialPort = new SerialPort("COM3", {
  baudRate: 57600 ,
        dataBits: 8,
        parity: 'none',
        stopBits: 1,
        //parser: SerialPort.parsers.readline("\n"),
        flowControl: false
}, false); // this is the openImmediately flag [default is true]

serialPort.open(function (error) {
  if ( error ) {
    console.log('failed to open: '+error);
  } else {
    console.log('open');
    serialPort.on('data', function(data) {
      console.log('data received: ' + data);
    });
    serialPort.write("ls\n", function(err, results) {
      console.log('err ' + err);
      console.log('results ' + results);
    });
  }
});

and got below output

open
err undefined
results 3
data received: ��yStandardFirmata.ino�

But when I connected to Bluetooth using BlueTerm app in my android phone and try to send data nothing is displayed on console. Can you please help me on this. I have also followed #165 issue but still not able to figure out the solution. Request you to kindly help me on this.

sarkarstanmoy commented 8 years ago

Any update on this issue

soundanalogous commented 8 years ago

First of all, the issue you are experiencing appears to be related to node-serialport, not johnny-five. It may be helpful to open this issue for that project.

You are receiving the REPORT_FIRMWARE query results upon establishing the serial connection as expected: ����y��StandardFirmata.ino�, the console just isn't printing the non ascii characters. However, I'm not sure why you're getting the error on serial write.

sarkarstanmoy commented 8 years ago

Thanks for the reply. As you have suggested I will raise this issue to node-serialport team.

dtex commented 6 years ago

Hi @sarkarstanmoy Is it okay to close this issue?

dtex commented 6 years ago

Hi @sarkarstanmoy

I'm going to close this since we haven't heard back. Feel free to re-open if necessary.