displaying on SSD1306, 128x64 pixels OLED
main.cpp@0:950ea6fc2190, 2020-02-12 (annotated)
- Committer:
- bvirk
- Date:
- Wed Feb 12 03:36:17 2020 +0000
- Revision:
- 0:950ea6fc2190
- Child:
- 1:ad7869e467a8
initial Main worked
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
bvirk | 0:950ea6fc2190 | 1 | |
bvirk | 0:950ea6fc2190 | 2 | #include "MicroBit.h" |
bvirk | 0:950ea6fc2190 | 3 | |
bvirk | 0:950ea6fc2190 | 4 | MicroBit uBit; |
bvirk | 0:950ea6fc2190 | 5 | |
bvirk | 0:950ea6fc2190 | 6 | int main() |
bvirk | 0:950ea6fc2190 | 7 | { |
bvirk | 0:950ea6fc2190 | 8 | uBit.init(); |
bvirk | 0:950ea6fc2190 | 9 | |
bvirk | 0:950ea6fc2190 | 10 | int8_t ar[] = {65,66,67,68}; |
bvirk | 0:950ea6fc2190 | 11 | char buf[5]; |
bvirk | 0:950ea6fc2190 | 12 | for (int8_t i= 0; i<4; i++) |
bvirk | 0:950ea6fc2190 | 13 | buf[i]=ar[i]; |
bvirk | 0:950ea6fc2190 | 14 | buf[5]='\0'; |
bvirk | 0:950ea6fc2190 | 15 | uBit.display.scroll(buf); |
bvirk | 0:950ea6fc2190 | 16 | |
bvirk | 0:950ea6fc2190 | 17 | // If main exits, there may still be other fibers running or registered event handlers etc. |
bvirk | 0:950ea6fc2190 | 18 | // Simply release this fiber, which will mean we enter the scheduler. Worse case, we then |
bvirk | 0:950ea6fc2190 | 19 | // sit in the idle task forever, in a power efficient sleep. |
bvirk | 0:950ea6fc2190 | 20 | release_fiber(); |
bvirk | 0:950ea6fc2190 | 21 | } |
bvirk | 0:950ea6fc2190 | 22 |