8ABELI Socket Programming

Dependencies:   mbed mbed-rtos EthernetInterface

Files at this revision

API Documentation at this revision

Comitter:
fpucher
Date:
Mon Mar 23 13:05:31 2020 +0000
Parent:
7:a5ead1402704
Commit message:
8ABELI Socket Programming

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Mon May 04 22:47:02 2015 +0000
+++ b/main.cpp	Mon Mar 23 13:05:31 2020 +0000
@@ -1,7 +1,22 @@
+// https://developer.mbed.org/handbook/Socket
 #include "mbed.h"
 #include "EthernetInterface.h"
 
 #define ECHO_SERVER_PORT   7
+class Blinky {
+    DigitalOut _myled;
+    int zahl;
+public:
+    Blinky(PinName ld) : _myled(ld), zahl(0) {}
+    void LedOn() {
+        _myled = 1;
+    }
+    void LedOff() {
+        _myled = 0;
+    }
+};
+
+Blinky bl(LED1);
 
 int main (void) {
     EthernetInterface eth;
@@ -39,7 +54,11 @@
             
             // print reversed message to terminal
             printf("Sending message to Client: '%s'\n",buffer);
-            
+            bl.LedOn();
+            wait(0.5);
+            bl.LedOff();
+            wait(0.5);
+
             // Echo received message back to client
             client.send_all(buffer, n);
             if (n <= 0) break;