Display an animated Sinuswave using GREY_SCALE_MODE for the display. Well - its my forst program.

Dependencies:   microbit

Files at this revision

API Documentation at this revision

Comitter:
DieOma
Date:
Tue Aug 22 09:37:33 2017 +0000
Commit message:
Just optimized

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
microbit.lib Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Tue Aug 22 09:37:33 2017 +0000
@@ -0,0 +1,30 @@
+
+#include "MicroBit.h"
+#include "mbed.h"
+#include <math.h>       /* sin */
+
+
+//A little Animation for using GREY_SCALE_MODE
+MicroBit        uBit;
+MicroBitImage   map(5,5);  
+
+int main() {
+   uBit.init();
+   uBit.display.print(map);
+   uBit.display.setDisplayMode(DISPLAY_MODE_GREYSCALE);
+   int value = 250;
+   int k = 0;
+   while (1) {
+    for(int i = 0; i<5;i++){
+       for(int j = 0; j < 5; j++){
+       value = (125 *(1 +  sin((i+k) * PI / 10)));
+            uBit.display.image.setPixelValue(i,j, value);           }
+       
+    };
+    k++;
+    uBit.sleep(100);  
+    
+     
+   };
+  
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/microbit.lib	Tue Aug 22 09:37:33 2017 +0000
@@ -0,0 +1,1 @@
+https://mbed.org/teams/Lancaster-University/code/microbit/#4b89e7e3494f