JavaScript ❤️ Embedded Devices
- Upload the code below to your favorite Arduino board
void setup() {
Serial.begin(115200);
pinMode(LED_BUILTIN, OUTPUT);
}
void loop() {
int cmd = Serial.parseInt();
switch (cmd) {
case -1:
digitalWrite(LED_BUILTIN, LOW);
break;
case 1:
digitalWrite(LED_BUILTIN, HIGH);
break;
default:
break;
}
- Connect this Arduino board to your PC
- Enable the experimental web platform features of your web browser in use, e.g.
chrome://flags/#enable-experimental-web-platform-features
opera://flags/#enable-experimental-web-platform-features
edge://flags/#enable-experimental-web-platform-features
- Open the example page: index.html of this repository
- Connect to your Arduino board by selecting the corresponding COM port
- Toggle the build-in LED of your Arduino board
- Quit the serial connection by closing the corresponding web browser tab