Mesud KLisura Arnela Duzan

Dependencies:   TSI mbed

Files at this revision

API Documentation at this revision

Comitter:
tim004
Date:
Thu May 08 18:13:56 2014 +0000
Commit message:
LV8Grupa7tim004

Changed in this revision

TSI.lib 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
mbed.bld Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TSI.lib	Thu May 08 18:13:56 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/vsluiter/code/TSI/#4dc2f5a3a731
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Thu May 08 18:13:56 2014 +0000
@@ -0,0 +1,47 @@
+#include "mbed.h"
+#include "TSISensor.h"
+ 
+PwmOut red(LED_RED);
+PwmOut green(LED_GREEN);
+PwmOut blue(LED_BLUE);
+ 
+Serial pc(USBTX, USBRX);
+TSISensor senzor;
+ 
+Ticker tick;
+ 
+void ispisi()
+{
+    pc.printf("Senzor: %g %\n", senzor.readPercentage()*100);
+ 
+}
+
+void Ukljuci(char c, float i) {
+    
+    if(c == 'R') red = i;
+    else if(c == 'G') green = i;
+    else if(c == 'B') blue = i;
+    else return;
+}
+ 
+int main()
+{
+    red = 1;
+    green = 1;
+    blue = 1;  
+ 
+    while(1)
+    {
+        char znak = pc.getc();
+        if(znak == 'P') tick.attach(&ispisi, 1);
+        else if(znak=='Z') tick.detach();
+        else 
+        {
+            int p=(pc.getc() - '0') * 10;
+            int d=pc.getc() - '0';
+            red = green = blue = 1;
+            float intenzitet=(p+d)/100.;
+            Ukljuci(znak,intenzitet);
+        }
+    }
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Thu May 08 18:13:56 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/8a40adfe8776
\ No newline at end of file