![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
8ABELI Socket Programming
Dependencies: mbed mbed-rtos EthernetInterface
Diff: main.cpp
- Revision:
- 8:2c91833ef350
- Parent:
- 7:a5ead1402704
diff -r a5ead1402704 -r 2c91833ef350 main.cpp --- 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;