DEUXIEME PROG

Dependencies:   Servo mbed

Files at this revision

API Documentation at this revision

Comitter:
meddahihadj
Date:
Thu Feb 19 13:29:00 2015 +0000
Parent:
0:a1c8577f66c5
Commit message:
DEUXIEME PROGRAMME

Changed in this revision

ethernet.cpp Show annotated file Show diff for this revision Revisions of this file
flashled.cpp 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
diff -r a1c8577f66c5 -r 32ebac4d3716 ethernet.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ethernet.cpp	Thu Feb 19 13:29:00 2015 +0000
@@ -0,0 +1,20 @@
+#include "mbed.h"
+ 
+Ethernet eth;
+ 
+int ether() {
+    char buf[0x600];
+ 
+    while(1) {
+        int size = eth.receive();
+        if(size > 0) {
+            eth.read(buf, size);
+            printf("Destination:  %02X:%02X:%02X:%02X:%02X:%02X\n",
+                    buf[0], buf[1], buf[2], buf[3], buf[4], buf[5]);
+            printf("Source: %02X:%02X:%02X:%02X:%02X:%02X\n",
+                    buf[6], buf[7], buf[8], buf[9], buf[10], buf[11]);
+        }
+ 
+        wait(1);
+    }
+}
diff -r a1c8577f66c5 -r 32ebac4d3716 flashled.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/flashled.cpp	Thu Feb 19 13:29:00 2015 +0000
@@ -0,0 +1,12 @@
+#include "mbed.h"
+ 
+DigitalOut led(LED3);
+ 
+int flash () {
+    while(1) {
+        led = 1;
+        wait(0.5);
+        led = 0;
+        wait(0.2);
+    }
+}
\ No newline at end of file
diff -r a1c8577f66c5 -r 32ebac4d3716 main.cpp
--- a/main.cpp	Wed Feb 11 10:52:06 2015 +0000
+++ b/main.cpp	Thu Feb 19 13:29:00 2015 +0000
@@ -1,25 +1,25 @@
 #include "mbed.h"
 #include "Servo.h"
 
-DigitalOut myled(LED1);
+DigitalOut allumLED(LED1);
 
-int main (){
-   Serial pc(USBTX,USBRX);
+int main ()
+{
+    Serial pc(USBTX,USBRX);
 //: int main(){
-      
-          while(1){
-             Serial pc(USBTX, USBRX); // tx, rx
-         //Serial pc(USBTX, USBRX);
+
+    while(1) {
+        Serial pc(USBTX, USBRX); // tx, rx
+        //Serial pc(USBTX, USBRX);
 //int main() {
-             pc.printf("Hello World!\n");
-             while(1) {
-                pc.putc(pc.getc() + 1);
+        pc.printf("hadj  test\n");
+        while(1) {
+            pc.putc(pc.getc() + 1);
+        }
+        allumLED=1;
+        wait(0.5);
+        allumLED=0;
+        wait(1);
+        //Servo::write(0.2)
     }
-                myled=1;
-                wait(0.5);
-                myled=0;
-                wait(1);
-        //Servo::write(0.2)
-              }   
-          }
-  
\ No newline at end of file
+}