Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
function onStart( ) {
var x = 0;
var y = 0;
var forward = true;
while (true) {
if (microbit.isOn(x, y)) {
microbit.off(x, y);
microbit.off(4-x, y);
}else {
microbit.on(x, y);
microbit.on(4-x, y);
}
if (forward) {
x = x + 1;
forward = x <= 4;
}else {
x = x - 1;
forward = !( x >= 0 );
}
y = x;
wait(50);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment