UIPEthernet library for Arduino IDE, Eclipse with arduino plugin and MBED/SMeshStudio (AVR,STM32F,ESP8266,Intel ARC32,Nordic nRF51,Teensy boards,Realtek Ameba(RTL8195A,RTL8710)), ENC28j60 network chip. Compatible with Wiznet W5100 Ethernet library API. Compiled and tested on Nucleo-F302R8. Master repository is: https://github.com/UIPEthernet/UIPEthernet/
Diff: examples/UdpServer/UdpServer.ino
- Revision:
- 11:3fb19220d9ec
- Parent:
- 0:e3fb1267e3c3
- Child:
- 12:aef29fbc4a62
diff -r cd62b2205c2a -r 3fb19220d9ec examples/UdpServer/UdpServer.ino --- a/examples/UdpServer/UdpServer.ino Thu Dec 29 11:18:05 2016 +0000 +++ b/examples/UdpServer/UdpServer.ino Thu Dec 29 13:07:19 2016 +0100 @@ -14,13 +14,25 @@ * Copyright (C) 2013 by Norbert Truchsess (norbert.truchsess@t-online.de) */ +#if defined(__MBED__) + #include <mbed.h> + #include "mbed/millis.h" + #define delay(x) wait_ms(x) + #define PROGMEM + #include "mbed/Print.h" +#endif + #include <UIPEthernet.h> #include "utility/logging.h" EthernetUDP udp; +#if defined(ARDUINO) void setup() { - +#endif +#if defined(__MBED__) +int main() { +#endif #if ACTLOGLEVEL>LOG_NONE LogObject.begin(9600); #endif @@ -35,11 +47,15 @@ LogObject.uart_send_str(F("initialize: ")); LogObject.uart_send_strln(success ? "success" : "failed"); #endif - +#if defined(ARDUINO) } void loop() { +#endif +#if defined(__MBED__) +while(true) { +#endif //check for new udp-packet: int size = udp.parsePacket(); if (size > 0) { @@ -105,3 +121,6 @@ #endif } } +#if defined(__MBED__) +} +#endif