Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
main.cpp
00001 #include "MicroBit.h" 00002 00003 #include "cppNorm.h" 00004 #include "OLED.h" 00005 #include "Display.h" 00006 00007 MicroBit uBit; 00008 OLED oled; 00009 Display display(uBit.display); // only ref to uninitialized uBit 00010 00011 void example_OLED(); 00012 void example_stick(); 00013 void example_BinaryRows(); 00014 void example_clock(); 00015 void example_secClock(); 00016 void example_assert(); 00017 void example_flag(); 00018 void example_peek(); 00019 00020 00021 struct { 00022 void (*example)(void); 00023 string name; 00024 } examples[] = { 00025 {example_OLED,"OLED"} 00026 ,{example_stick,"stick"} 00027 ,{example_BinaryRows,"binaryRows"} 00028 ,{example_clock,"clock"} // 17:31 00029 ,{example_secClock,"sec-clock"} // 17:31:00 00030 ,{example_assert,"assertion"} 00031 ,{example_flag,"flag"} 00032 ,{example_peek,"peek"} 00033 }; 00034 00035 void showExample(string name) { 00036 for (int8_t i = 0; i < sizeof(examples)/sizeof(examples[0]); i++) 00037 if (name == examples[i].name) 00038 (examples[i].example)(); 00039 00040 } 00041 /** 00042 * In absence of terminal or bluetooth command interface, chose an example by hand 00043 */ 00044 int main() { 00045 uBit.init(); 00046 00047 // change to try 00048 showExample("flag"); 00049 uBit.panic(987); 00050 } 00051
Generated on Mon Jul 18 2022 21:57:34 by
1.7.2