4 ms·
You don't need to create the whole page structure like in the example though. html, head and body tags are optional under certains conditions. [1] I guess you
by 0x4a42 11y ago
You don't need to create the whole page structure like in the example though. html, head and body tags are optional under certains conditions. [1]
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...).
[1] http://www.w3.org/TR/html-markup/ http://www.w3.org/TR/html-markup/
- mhandley 11y agoThe equivalent stock Arduino demo is blink: 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.
- MatthewPhillips 11y agoJust using script tags will work in every modern browser. I can't even remember how far back in IE you have to go for it not to work there.