Open happierco opened 7 years ago
Hey @happierco , You can use BluetoothSerial.on('data', (data) => ...do something with data)
BluetoothSerial.on('data', (data) => { console.log(data); });
Can not receive data.
Hao can I read the byte from device.I do not want the string result.
I get the listener for receiving data working by the following way. Note that you have to replace the delimiter '\r\n' with the one upon your own case.
BluetoothSerial.withDelimiter('\r\n').then((res)=>{ console.log("delimiter setup",res); BluetoothSerial.on('read',(data)=>{ console.log('read',data); }) })
I get the listener for receiving data working by the following way. Note that you have to replace the delimiter '\r\n' with the one upon your own case.
BluetoothSerial.withDelimiter('\r\n').then((res)=>{ console.log("delimiter setup",res); BluetoothSerial.on('read',(data)=>{ console.log('read',data); }) })
where should I put these codes?
BluetoothSerial.withDelimiter('\r\n').then((res)=>{ console.log("delimiter setup",res); BluetoothSerial.on('read',(data)=>{ console.log('read',data); })
I have same question, did @goldfishinsky solve this problem ?
I get the listener for receiving data working by the following way. Note that you have to replace the delimiter '\r\n' with the one upon your own case.
BluetoothSerial.withDelimiter('\r\n').then((res)=>{ console.log("delimiter setup",res); BluetoothSerial.on('read',(data)=>{ console.log('read',data); }) })
I know this issue is a little old but, Should we place on("read") listener in "withDelimiter" method
All I want actually, listening constantly for data from HC05 module to app. Only thing I can do is checking module manually with readFromDevice method.
@yalcinozer Have been able to figure out how to do it. I actually have the same application goal. I need to constantly listen for data from a HC05 module.
@ramacha7 using delimiters is a must be. You also should call functions repeatedly to read data. If you have any option use "BLE" devices. At some point I just gave up checking if data received or not.
I need to read from a barcode scanner without using an input field. Is there a listener I can use?