mirror of
https://github.com/espruino/Espruino.git
synced 2025-12-08 19:06:15 +00:00
15 lines
300 B
JavaScript
15 lines
300 B
JavaScript
var r = "";
|
|
var v = 0;
|
|
var pin = {
|
|
something : "foo",
|
|
read : function() { r+="r"+this.something; v=!v; return v; },
|
|
write : function(v) { r+="w"+this.something+v },
|
|
};
|
|
|
|
r += digitalRead(pin);
|
|
r += digitalRead(pin);
|
|
digitalWrite(pin,1);
|
|
digitalWrite(pin,0);
|
|
|
|
result = r=="rfoo1rfoo0wfoo1wfoo0";
|