Letter, points and light. Stars demo, scroll demo, flare demo, bounce demo

Dependencies:   microbit

MicroBit Graphics Demo

  • FunctionPointFlare();
  • FunctionBounceTest();
  • FunctionImageTest();
  • FunctionPrintTest();
  • FunctionStarTest();
  • FunctionImageScroll();
Committer:
MaxScorda
Date:
Mon Jun 03 23:07:04 2019 +0000
Revision:
3:7fb07f1eeffe
Parent:
2:b767fa1c9241
Child:
4:47230ba0a5f0
Stars test

Who changed what in which revision?

UserRevisionLine numberNew contents of line
MaxScorda 0:b5464e0c4a8c 1
MaxScorda 0:b5464e0c4a8c 2 #include "MicroBit.h"
MaxScorda 0:b5464e0c4a8c 3 #include "mbed.h"
MaxScorda 0:b5464e0c4a8c 4 #include <math.h> /* sin */
MaxScorda 2:b767fa1c9241 5 #include <stdlib.h>
MaxScorda 0:b5464e0c4a8c 6 #include <string>
MaxScorda 0:b5464e0c4a8c 7
MaxScorda 0:b5464e0c4a8c 8
MaxScorda 1:ed77b498d5c8 9 //-----------------Init
MaxScorda 0:b5464e0c4a8c 10 MicroBit uBit;
MaxScorda 0:b5464e0c4a8c 11 MicroBitImage map(5,5);
MaxScorda 0:b5464e0c4a8c 12 MicroBitDisplay display;
MaxScorda 0:b5464e0c4a8c 13
MaxScorda 1:ed77b498d5c8 14 //------------- Vars
MaxScorda 1:ed77b498d5c8 15 int oldx=-1, oldy=-1;
MaxScorda 1:ed77b498d5c8 16 int k = 0, i=0;
MaxScorda 1:ed77b498d5c8 17 int sign=1;
MaxScorda 1:ed77b498d5c8 18 int ccont=0;
MaxScorda 1:ed77b498d5c8 19 int sceltavar=0;
MaxScorda 1:ed77b498d5c8 20 //------------- Personal Libs
MaxScorda 1:ed77b498d5c8 21 #include "Images.h"
MaxScorda 1:ed77b498d5c8 22 #include "Functions.h"
MaxScorda 1:ed77b498d5c8 23
MaxScorda 0:b5464e0c4a8c 24 int main()
MaxScorda 0:b5464e0c4a8c 25 {
MaxScorda 0:b5464e0c4a8c 26 uBit.init();
MaxScorda 0:b5464e0c4a8c 27 uBit.display.print(map);
MaxScorda 0:b5464e0c4a8c 28 uBit.display.setDisplayMode(DISPLAY_MODE_GREYSCALE);
MaxScorda 1:ed77b498d5c8 29 uBit.messageBus.listen(MICROBIT_ID_BUTTON_A, MICROBIT_EVT_ANY, onButton);
MaxScorda 1:ed77b498d5c8 30 uBit.messageBus.listen(MICROBIT_ID_BUTTON_B, MICROBIT_EVT_ANY, onButton);
MaxScorda 3:7fb07f1eeffe 31 uBit.seedRandom();
MaxScorda 0:b5464e0c4a8c 32
MaxScorda 1:ed77b498d5c8 33 while (1) {
MaxScorda 1:ed77b498d5c8 34 if (sceltavar==0)
MaxScorda 1:ed77b498d5c8 35 FunctionPointFlare();
MaxScorda 1:ed77b498d5c8 36 else if (sceltavar==1)
MaxScorda 2:b767fa1c9241 37 FunctionBounceTest();
MaxScorda 1:ed77b498d5c8 38 else if (sceltavar==2)
MaxScorda 1:ed77b498d5c8 39 FunctionImageTest();
MaxScorda 2:b767fa1c9241 40 else if (sceltavar==3)
MaxScorda 2:b767fa1c9241 41 FunctionPrintTest();
MaxScorda 3:7fb07f1eeffe 42 else if (sceltavar==4)
MaxScorda 3:7fb07f1eeffe 43 FunctionStarTest();
MaxScorda 0:b5464e0c4a8c 44
MaxScorda 1:ed77b498d5c8 45 ccont++;
MaxScorda 0:b5464e0c4a8c 46 }
MaxScorda 0:b5464e0c4a8c 47 }
MaxScorda 1:ed77b498d5c8 48