• If the result was AT+CBC, the if should have returned and not printed that line?

    Can you try this:

    var at;
    console.log("Turning Cell on");
    require("iTracker").setCellOn(true, function(usart) {
      console.log("Cell now on");
      at = require("AT").connect(usart);
      at.cmd("AT+CBC\r\n",1000,function cb(d) {
        if (d=="AT+CBC") return cb;
        if (d!="OK") console.log("CBC is "+JSON.stringify(d));
      });
    });
    

    so that we can see if there are any extra characters in there?

  • Great idea. It worked now using "AT+CBC\r" for comparison. Thank you. Then you get these values: [bcs, bcl, voltage]
    The second one (bcl) returns the battery charge level in percent. So it is exactly what I wanted. By the way bcs shows if the battery is charging. I guess that this is the most elegant way to get the battery level.

About

Avatar for Gordon @Gordon started