Ljubuncic Orhan Odobasic Faris

Dependencies:   TSI mbed

Files at this revision

API Documentation at this revision

Comitter:
tim008
Date:
Mon May 05 08:49:36 2014 +0000
Commit message:
LV8_Pai_Zad1_Grupa2_tim008

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
diff -r 000000000000 -r 217dea37c86b TSI.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TSI.lib	Mon May 05 08:49:36 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/vsluiter/code/TSI/#4dc2f5a3a731
diff -r 000000000000 -r 217dea37c86b main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Mon May 05 08:49:36 2014 +0000
@@ -0,0 +1,53 @@
+#include "mbed.h"
+#include "TSISensor.h"
+
+PwmOut red(LED_RED);
+PwmOut green(LED_GREEN);
+PwmOut blue(LED_BLUE);
+
+Serial pc(USBTX, USBRX);
+TSISensor tsi;
+
+Ticker tSenzor;
+
+void ispisSenzora()
+{
+    pc.printf("Vrijednost TSI senzora: %.2f %%\n", tsi.readPercentage());
+
+}
+
+int main()
+{
+    red = 1.0f;
+    green = 1.0f;
+    blue = 1.0f;
+    
+
+    while(1)
+    {
+        char c = pc.getc();
+        
+        if(c=='P') tSenzor.attach(&ispisSenzora, 1);
+        
+        else if(c=='Z') tSenzor.detach();
+        
+        else if(c=='R' || c=='G' || c=='B')
+        {
+            int d((pc.getc() - '0') * 10);
+            int j(pc.getc() - '0');
+            
+            red = green = blue = 1.0f; // iskljuciSve
+            
+            float intenzitet((d+j)/100.);
+            
+            if(c=='R') red = 1.0 - intenzitet;
+            else if(c=='G') green = 1.0 - intenzitet;
+            else blue = 1.0 - intenzitet;
+        
+        }
+        
+        
+    
+    }
+
+}
\ No newline at end of file
diff -r 000000000000 -r 217dea37c86b mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Mon May 05 08:49:36 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/8a40adfe8776
\ No newline at end of file