Programs - loristissino/RoboThree GitHub Wiki
Simple, high-level programs
It should be possible to run simple programs like this one:
for ( var i = 0; i<3; i++ ) {
penDown();
moveForward(20);
penUp();
moveForward(20);
}
JavaScript normally executes commands asynchronously, but in this case we want to wait that the robot does something (in the example, that it moves forward for 20 cm) before going on with the execution. The trick is to use synchronous calls to external processes that execute the command, in order to wait for its completion.
This is still experimental and far from perfection, but somehow it works. See the example in the programs
directory to understand how the magic happens.