Hello world for com stuff :--)

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
JosephITA
Date:
Wed Mar 07 18:18:01 2012 +0000
Commit message:
1.00

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
diff -r 000000000000 -r dd3b77ab642a main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Wed Mar 07 18:18:01 2012 +0000
@@ -0,0 +1,95 @@
+#include "mbed.h"
+
+DigitalOut myled1(LED1);
+DigitalOut myled2(LED2);
+DigitalOut myled3(LED3);
+DigitalOut myled4(LED4);
+Serial pc(USBTX, USBRX);
+
+#define tempo 0.1
+
+
+void superCar(float durata){
+
+
+
+
+    myled1=!myled1;
+    wait(durata);
+    myled1=!myled1;
+    myled2=!myled2;
+    wait(durata);
+    myled2=!myled2;
+    myled3=!myled3;
+    wait(durata);
+    myled3=!myled3;
+    myled4=!myled4;
+     wait(durata);
+    myled4=!myled4;
+    myled3=!myled3;
+    wait(durata);
+    myled3=!myled3;
+    myled2=!myled2;
+    wait(durata);
+    myled1=!myled1;
+    myled2=0;
+     wait(durata);
+    myled1=!myled1;
+   
+  
+
+}
+
+
+void ledInit(){
+
+ myled1=0;
+  
+  myled2=0;
+  
+  myled3=0;
+  
+  myled4=0;
+
+
+}
+
+int main() {
+
+ pc.printf("***************************************\n");
+ pc.printf("Commy! ver 1.000000 6 marzo 2012\n");
+ pc.printf("***************************************\n");
+ pc.printf("1 2 3 4 for turn on and off leds, ? info, s per superCar\n");
+
+    while(1) {
+    
+      
+      if(pc.readable()){
+        char c = pc.getc();
+        
+        if(c=='1')
+        myled1=!myled1;
+        if(c=='2')
+        myled2=!myled2;
+        if(c=='3')
+        myled3=!myled3;
+        if(c=='4')
+        myled4=!myled4;
+         if(c=='s'){
+         ledInit();
+         superCar(tempo);
+         ledInit();
+         }
+         if(c=='?'){
+        pc.printf("***************************************\n");
+ pc.printf("Commy! ver 1.000000 6 marzo 2012\n");
+ pc.printf("***************************************\n");
+  pc.printf("1 2 3 4 for turn on and off leds, ? info, s per superCar\n"); 
+        
+        
+        }
+        pc.printf("-> %c\n",c);
+
+    }
+  } 
+}
diff -r 000000000000 -r dd3b77ab642a mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Wed Mar 07 18:18:01 2012 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/4c0c40fd0593