A program for the BBC MicroBit that displays temperature and compass headings.

Dependencies:   microbit

Files at this revision

API Documentation at this revision

Comitter:
daw9000
Date:
Mon Jul 25 15:11:06 2016 +0000
Parent:
3:4476ce40b910
Child:
5:2314ad5e8997
Commit message:
too much sleep ZZZZZzzzzzzzz in wrong places

Changed in this revision

source/main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/source/main.cpp	Mon Jul 25 11:32:40 2016 +0000
+++ b/source/main.cpp	Mon Jul 25 15:11:06 2016 +0000
@@ -121,7 +121,6 @@
         if (mode>2)
         {
             mode=0;
-            uBit.sleep(100);
         }
        }
        
@@ -136,7 +135,6 @@
             else{
                 uBit.display.setBrightness(5);
                 }
-                uBit.sleep(100);
                 
         }
                 
@@ -155,7 +153,6 @@
             {
                  uBit.display.setBrightness(255);
             }
-            uBit.sleep(100);
             
         }
         }
@@ -164,16 +161,16 @@
     if (e.source == MICROBIT_ID_IO_P2)
     {
           
-    if (uBit.io.P2.isTouched())
-    {
+       if (uBit.io.P2.isTouched())
+       {
          uBit.display.scroll("DevTemp=");
    
         uBit.display.scroll( uBit.thermometer.getTemperature());
-        uBit.sleep(100);
-        }
+        
+       }
         
-        }
     }
+}
 compassRef compassPoints(short compassHeading)
 {
 
@@ -232,13 +229,13 @@
         uBit.display.scroll("Temp=");
    
         uBit.display.scroll( uBit.thermometer.getTemperature() + xx);
-        uBit.sleep(100);
+        uBit.sleep(1000);
       }
       if (mode==1)
       {
         uBit.display.scroll("Hdg:");
         uBit.display.scroll(uBit.compass.heading());
-        uBit.sleep(100);
+        uBit.sleep(1000);
       }
       if (mode==2)
       {
@@ -250,9 +247,7 @@
         short offsetX = myCompass.offsetX;
         short offsetY = myCompass.offsetY;
         uBit.display.print(mImage,offsetX,offsetY);
-        uBit.sleep(100);
-      
-        
+        uBit.sleep(250);
        }
     
 
@@ -261,6 +256,7 @@
     // If main exits, there may still be other fibers running or registered event handlers etc.
     // Simply release this fiber, which will mean we enter the scheduler. Worse case, we then
     // sit in the idle task forever, in a power efficient sleep.
+    
     release_fiber();
 
 }
\ No newline at end of file