Gordon, thank you. I could not get it to work. I will be away 3 days.
I was seeking a solution to get this simple test snippet to run, when not connected to a USB port of a computer. As I understood, the Serial port will be on USB by default. And on Serial1 by Default if unplugged. So this blocks my device (HM10). So I would like to set to USB or Serial2. I could not get it to work. I ll check later on it.
Serial=Serial1
Serial.setup(9600);
Serial.on('data', function (data) {
console.log(data);
if (data==='1'){
LED1.write(1);
Serial.print("test\n");
}
if (data==='0'){
LED1.write(0);
}
if (data==='d'){
LED2.write(1);
Serial.print("sensor: t="+temp_act+", p="+press_act+", h="+hum_act);
LED2.write(0);
}
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.
Gordon, thank you. I could not get it to work. I will be away 3 days.
I was seeking a solution to get this simple test snippet to run, when not connected to a USB port of a computer. As I understood, the Serial port will be on USB by default. And on Serial1 by Default if unplugged. So this blocks my device (HM10). So I would like to set to USB or Serial2. I could not get it to work. I ll check later on it.