Erik García / Mbed 2 deprecated iluminacion

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
through
Date:
Fri Feb 19 14:42:34 2016 +0000
Parent:
0:985d8bf2626d
Commit message:
iluminacion 2

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Fri Feb 19 13:18:25 2016 +0000
+++ b/main.cpp	Fri Feb 19 14:42:34 2016 +0000
@@ -1,16 +1,36 @@
 #include "mbed.h"
-
+Serial bt (PTE22, PTE23);
+Serial pc(USBTX,USBRX);
 PwmOut out(D3);
-AnalogIn pot(D2);
-int a=0;
+AnalogIn pot(A0);
+int x=0;
 
 int main() {
     
    
     while(1) {
             
-            a=pot;
-            out=a/1026;
+            if(bt.readable()){
+        x=bt.getc();
+        //bt.scanf("%c",&x);
+        //wait(0.2);  
+        //pc.printf("%c\n",x);
+  
+  
+        if(x=='1'){   
+        out=0.3;
+        }
+        if(x=='2'){
+        out=0.6;
+        }
+        if(x=='3'){
+        out=1;
+        }
+        if(x=='0'){
+        out=0;
+        }
+        }
+
             wait(0.1);
             
     }