Creating an entire HTML page structure just to get to the code because you need a <script> tag? Oh god.
I guess you could just write the example code like this :
<!doctype html>
<script src="gpio.js"></script>
<script>
var v = 0;
GPIO.getPort(196).then(
function(port) {
setInterval(toggleLight, 1000, port);
}
);
function toggleLight(port){
v = v ? 0 : 1;
port.write(v);
}
</script>
Just having the script tags would also probably works in most browsers but it wouldn't be standard compliant (if you care about it...). void setup() {
pinMode(13, OUTPUT);
}
void loop() {
digitalWrite(13, HIGH);
delay(1000);
digitalWrite(13, LOW);
delay(1000);
}
From my experience of teaching many non-programmers how to use this sort of device, I think I'll stick with Arduino for now.It's the pretense of putting it all in an HTML document. The point of HTML is not anywhere close to the use case here. Javascript is way beyond its browser origins, why would it still need to be coupled? I can't imagine tossing in an HTML parser simplifies anything either.
Oh the memory though... GC's on embedded devices scare the hell out of me.