Took another look at the Serial.write cmd. I had the / \ mixed up. Now it seems to work.
On to the issue of reading and processing the send command output. Would a swicth statement in the serial.on("data") make sense?
if I send the command Serial.write("AT+CBC\n\r", 500, "+CBC",function(){}); to check the battery voltage I get +cbc: 0,94,3978 returned from the serial port. With a switch statement I could act on this by parsing the +cbc from the line and comparing it to the expected response from the Serial.write line (+CBC). If these agree I could then return an array for the 0,94,3878, that shows battery % charge left and the battery voltage.
I will try to code this later today if someone agrees this is a good way to proceed.
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Took another look at the Serial.write cmd. I had the / \ mixed up. Now it seems to work.
On to the issue of reading and processing the send command output. Would a swicth statement in the serial.on("data") make sense?
if I send the command Serial.write("AT+CBC\n\r", 500, "+CBC",function(){}); to check the battery voltage I get +cbc: 0,94,3978 returned from the serial port. With a switch statement I could act on this by parsing the +cbc from the line and comparing it to the expected response from the Serial.write line (+CBC). If these agree I could then return an array for the 0,94,3878, that shows battery % charge left and the battery voltage.
I will try to code this later today if someone agrees this is a good way to proceed.