Granulo Eldar Mehanovic Adnan

Dependencies:   mbed

Revision:
0:83ded6438f88
diff -r 000000000000 -r 83ded6438f88 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Mon Mar 31 09:37:16 2014 +0000
@@ -0,0 +1,31 @@
+#include "mbed.h"
+  
+AnalogIn photoresistor(dp9);
+PwmOut led(dp24);
+DigitalOut enable(dp14);
+DigitalOut led0(dp23);
+DigitalOut led2(dp25);
+DigitalOut led3(dp26);
+DigitalOut led4(dp27);
+DigitalOut led5(dp5);
+DigitalOut led6(dp6);
+DigitalOut led7(dp28);
+
+int main()
+{
+    enable = 0;
+    led0 = 0;
+    led2 = 0;
+    led3 = 0;
+    led4 = 0;
+    led5 = 0;
+    led6 = 0;
+    led7 = 0;
+    led.period_us(50);
+    while(1) {
+        double percentage((1 - ((photoresistor * 3.3 - 0.8) / 1.5)));
+        if(percentage > 1) 
+            percentage = 1;
+        led = 1 - percentage;
+    }
+}