Last active
April 17, 2016 01:17
-
-
Save mendesjorge/2be34353a62615630af75d0d32cfb629 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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