Skip to content
Snippets Groups Projects
Commit 703c8079 authored by ja3-saxby's avatar ja3-saxby
Browse files

Amend mistakes

parent faecddd8
No related branches found
No related tags found
No related merge requests found
......@@ -143,7 +143,7 @@ private:
Block::Block()
: shape((Shape)UBIT.random(SHAPE_TYPES_COUNT)) // choose a random shape
, facing(NORTH) // for now, all shapes face North
, facing(RotationDirection::NORTH) // for now, all shapes face North
{}
MicroBitImage Block::image() const {
......@@ -167,24 +167,30 @@ int main() {
// Initialise the micro:bit runtime.
UBIT.init();
// draw first dot to indicate runtime system is initialised
UBIT.display.setPixelValue(0, 2, 255);
UBIT.display.image.setPixelValue(0, 2, 255);
// seed the PRNG with the HRNG
UBIT.seedRandom();
// draw second dot to indicate PRNG has been seeded
UBIT.display.setPixelValue(2, 2, 255);
UBIT.display.image.setPixelValue(2, 2, 255);
// ensure display is set to black and white mode
UBIT.display.setDisplayMode(DISPLAY_MODE_BLACK_AND_WHITE);
// draw third and final dot to indicate screen has been set up
UBIT.display.setPixelValue(4, 2, 1);
UBIT.display.image.setPixelValue(4, 2, 1);
UBIT.display.scroll("BLOCKS!");
// XXX: simple debug test to check my FLASH images were stored correctly
// a simple clocker to check frame rate
bool strober = false;
while (true) {
// display new random blocks each second
Block block;
UBIT.display.print(block.image(), 1, 1);
UBIT.display.print(block.image(), 2, 2);
// display clocker
UBIT.display.image.setPixelValue(0, 0, strober);
UBIT.sleep(1000); // 1000ms or 1s sleep
// invert the clocker
strober = !strober;
}
// TODO: potentially remove this call, if clarified that it is not required.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment