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

Dependencies:   microbit

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 
00002 #include "MicroBit.h"
00003 #include "mbed.h"
00004 #include <math.h>       /* sin */
00005 #include <stdlib.h>
00006 #include <string>
00007 
00008 
00009 //-----------------Init
00010 MicroBit        uBit;
00011 MicroBitImage   map(5,5);
00012 MicroBitDisplay display;
00013 
00014 //------------- Vars
00015 int oldx=-1, oldy=-1;
00016 int k = 0, i=0;
00017 int sign=1;
00018 int ccont=0;
00019 int sceltavar=0;
00020 //------------- Personal Libs
00021 #include "Images.h"
00022 #include "Functions.h"
00023 
00024 int main()
00025 {
00026     uBit.init();
00027     uBit.display.print(map);
00028     uBit.display.setDisplayMode(DISPLAY_MODE_GREYSCALE);
00029     uBit.messageBus.listen(MICROBIT_ID_BUTTON_A, MICROBIT_EVT_ANY, onButton);
00030     uBit.messageBus.listen(MICROBIT_ID_BUTTON_B, MICROBIT_EVT_ANY, onButton);
00031     uBit.seedRandom(); 
00032 
00033     while (1) {
00034         if (sceltavar==0)
00035             FunctionPointFlare();
00036         else if (sceltavar==1)
00037             FunctionBounceTest();
00038         else if (sceltavar==2)
00039             FunctionImageTest();
00040         else if (sceltavar==3)
00041             FunctionPrintTest();
00042         else if (sceltavar==4)
00043             FunctionStarTest();
00044              else if (sceltavar==5)       
00045             FunctionImageScroll();
00046 
00047         ccont++;
00048     }
00049 }
00050