Right to it then...
I am using an HC-05 bluetooth module to communicate with my HTML CSS JAVASCRIPT mobile phone application.
I am hoping someone is able to help me with the communication.
SNIPPET OF ARDUINO IN LOOP
if(Serial.available()>0)
{
Serial.println("Trying to assign drillnumber and reps to variables");
drillnumber = Serial.read();
Serial.println(drillnumber);
reps = Serial.read();
Serial.println(reps);
}
However, sometimes i get the correct drillnumber sent over - ex. "1" and reps number -ex "5"
other times they print out
1
255
5
255
javascript
var drill = 0;
when button pressed
drill = this.title;
var $elSlider = $("#slider");
reps = parseInt($elSlider.val());
console.log(drill);
console.log(reps);
var drillreps = [drill, reps];
console.log(drillreps);
bluetoothSerial.write(drillreps, function (success) {
console.log("Data Successfully sent:" + success);
console.log("HERE WAS .write SUCCESSFUL");
timestart = performance.now();
GateTotal = gates * reps;
gatecurrent = 1;
j = 0;
repscount = 1;
fnDrawTable();
Any help on transferring data would be helpful. I am using this cordova plugin
Any help on data transfer between the two objects correctly would be appreciated.
Also need the bluetooth module to send to the phone.