test

Dependencies:   BLE_API nRF51822 mbed

Fork of KS7 by masaaki makabe

Revision:
2:09bf05d66065
Parent:
0:08c8325a21ec
Child:
3:2398a9368c9b
--- a/main.cpp	Thu Oct 22 04:42:42 2015 +0000
+++ b/main.cpp	Thu Oct 22 06:21:38 2015 +0000
@@ -21,18 +21,23 @@
         while(io.get_switch() == 1); // wait until switch released
         fPow = 0;
     }
+
+//    io.display_value = (uint16_t)(io.get_weight() * 9999.0); // dummy display
+    io.display_value = (int)(io.get_x() * 9900 + io.get_y() * 99); // test: display joystick XY value
+
     io.analog_pow(0); // turn analog power off
 }
 
 int main()
 {
-    tk.attach(&ticker_1s, 1);
+    tk.attach(&ticker_1s, 0.1);
     io.calibrate_weight(); // initial calibration
     while(1){
-        for (float i = 0.0; i < 1.0; i+=0.05){
-            io.display(i); // change display brightneess
+        for (float i = 0; i < 1.0; i+=0.05){
+            if (i <0.5) io.display(1.0-i);
+            else io.display(i); // change display brightneess
             wait(0.1);
-            io.display_value = (uint16_t)(io.get_weight() * 9999.0); // dummy display
+//            io.display_value = (uint16_t)(io.get_weight() * 9999.0); // dummy display
         }
     }
 }