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

Dependencies:   microbit

MicroBit Graphics Demo

  • FunctionPointFlare();
  • FunctionBounceTest();
  • FunctionImageTest();
  • FunctionPrintTest();
  • FunctionStarTest();
  • FunctionImageScroll();

Files at this revision

API Documentation at this revision

Comitter:
MaxScorda
Date:
Wed Jan 01 10:23:12 2020 +0000
Parent:
3:7fb07f1eeffe
Commit message:
Publish

Changed in this revision

Functions.h Show annotated file Show diff for this revision Revisions of this file
Images.h Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 7fb07f1eeffe -r 47230ba0a5f0 Functions.h
--- a/Functions.h	Mon Jun 03 23:07:04 2019 +0000
+++ b/Functions.h	Wed Jan 01 10:23:12 2020 +0000
@@ -43,12 +43,16 @@
 
 void FunctionImageTest()
 {
-    if (ccont%3==0)
+    if (ccont%3==0) {
+        display.setBrightness(255);
         uBit.display.print(C);
-    else if (ccont%3==1)
+    } else if (ccont%3==1) {
+        display.setBrightness(127);
         uBit.display.print(Cb);
-    else if (ccont%3==2)
+    } else if (ccont%3==2) {
+        display.setBrightness(64) ;
         uBit.display.print(Cd);
+    }
 
     uBit.sleep(500);
 
@@ -64,7 +68,7 @@
     static int yost;
     static int xcont=0;
     static int signx=1, signy=1;
-    int value= 128;
+    int value= 256;
     bool cambiay=false;
     int tempcolor;
 
@@ -76,7 +80,7 @@
 
     for(int i=0 ; i<=2; i++) {
         tempidx=(tempidx+i)%3;
-        tempcolor=value/((i+1)*4);
+        tempcolor=value/((i*32)+1);
         uBit.display.image.setPixelValue(xx[tempidx],yy[tempidx], tempcolor);
     }
     //se sbatte sul punto ostacolo o ha fatto due
@@ -139,17 +143,24 @@
                 stars[i][1]=-1;
         }
         uBit.display.image.setPixelValue(stars[i][0],stars[i][1], stars[i][3]);
-        uBit.serial.printf("\n%d: %d ",i,stars[i][1]);
+        //    uBit.serial.printf("\n%d: %d ",i,stars[i][1]);
     }
+    uBit.sleep(250);
+}
 
-    uBit.sleep(250);
+void FunctionImageScroll()
+{
+    display.setBrightness(255);
+    uBit.display.scrollAsync(W1,100);
+    uBit.sleep(500);
 
 }
 
+
 void onButton(MicroBitEvent e)
 {
-    static bool premuto=false;
-    int numfun=5;
+    static bool premuto=true;
+    int numfun=6;
     if ((e.source == MICROBIT_ID_BUTTON_A) && (premuto==false)) {
         sceltavar--;
         uBit.display.clear();
diff -r 7fb07f1eeffe -r 47230ba0a5f0 Images.h
--- a/Images.h	Mon Jun 03 23:07:04 2019 +0000
+++ b/Images.h	Wed Jan 01 10:23:12 2020 +0000
@@ -18,12 +18,12 @@
         1 0 0 1 1\n\
         0 1 0 1 1\n\
         0 0 1 1 1\n"); 
-MicroBitImage AND("\
-        0 0 1 1 0\n\
-        1 1 1 1 1\n\
-        0 0 1 1 1\n\
-        1 1 1 1 1\n\
-        0 0 1 1 0\n");
+MicroBitImage W1("\
+        0 0 1 0 0\n\
+        0 1 1 1 0\n\
+        0 1 0 1 0\n\
+        0 1 0 1 0\n\
+        1 0 0 0 1\n");
 
 MicroBitImage OR("\
         0 0 0 1 0\n\
diff -r 7fb07f1eeffe -r 47230ba0a5f0 main.cpp
--- a/main.cpp	Mon Jun 03 23:07:04 2019 +0000
+++ b/main.cpp	Wed Jan 01 10:23:12 2020 +0000
@@ -41,6 +41,8 @@
             FunctionPrintTest();
         else if (sceltavar==4)
             FunctionStarTest();
+             else if (sceltavar==5)       
+            FunctionImageScroll();
 
         ccont++;
     }