this s not working

Dependencies:   mbed tsi_sensor

Files at this revision

API Documentation at this revision

Comitter:
kuist1234
Date:
Tue Apr 19 20:46:40 2016 +0000
Commit message:
I really enjoy this program.;

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
tsi_sensor.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 Apr 19 20:46:40 2016 +0000
@@ -0,0 +1,38 @@
+#include "mbed.h"
+#include "tsi_sensor.h"
+
+/* This defines will be replaced by PinNames soon */
+#if defined (TARGET_KL25Z) || defined (TARGET_KL46Z)
+  #define ELEC0 9
+  #define ELEC1 10
+#elif defined (TARGET_KL05Z)
+  #define ELEC0 9
+  #define ELEC1 8
+#else
+  #error TARGET NOT DEFINED
+#endif
+
+int main(void) {
+    PwmOut led_g(LED_GREEN);
+    PwmOut led_r(LED_RED);
+    PwmOut led_b(LED_BLUE);
+    TSIAnalogSlider tsi(ELEC0, ELEC1, 40);
+    
+    while (true) {
+        float f = tsi.readPercentage();
+        if (f<.05)
+        {
+            led_b=0.0;
+            led_g=led_r=1.0;
+        }
+        else
+        {
+           led_b=1.0;
+           led_g=f;
+           } 
+           
+           
+
+        wait(0.1);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Tue Apr 19 20:46:40 2016 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/082adc85693f
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tsi_sensor.lib	Tue Apr 19 20:46:40 2016 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/Kojto/code/tsi_sensor/#976904559b5c