Hi everyone.
I have very simple question.
I’m using bluetooth-serial for connect and receive from arduino and i use readUntil(’\n’) for receive from arduino
I use readUntil with setInterval and inside constructor but I think this way wrong because it’s has very lag .
I need help for this situation.
constructor(private bluetoothSerial: BluetoothSerial, public navCtrl: NavController, public navParams: NavParams) {
setInterval(() => {
this.bluetoothSerial.readUntil('\n').then((data: any) => {
if (data.indexOf("code:") != -1) {
var si = data.indexOf("code:");
this.code = data.substring((si + 5), data.length);
}
});
}, 0);
}
I need read from arduino and find some information from sender device and i use substring for looking for some data and my situation very lag…
Thanks for help