Ok, I figured out a way. There must be more elegant ways to do this, but at least now I can see what I am receiving and I can take some actions depending on the messages.
Serial1.setup(2400/*baud*/);
Serial1.onData(function (e) {
var tr=(e.data);
p=tr.charCodeAt(0);
print(p);
switch (p)
{
case 80 :
var s = "CV,1.6A to 3A";
print(s);
break;
case 96 :
var s2 = "CV, < 1.6A";
print(s2);
break;
case 85 :
break;
default :
var s3="*";
print(s3);
}
});
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.
Ok, I figured out a way. There must be more elegant ways to do this, but at least now I can see what I am receiving and I can take some actions depending on the messages.