Nikita Kakurnikov
/
UDPNode
1
main.cpp@0:bed9e78dd09c, 2018-06-27 (annotated)
- Committer:
- nikitoslav
- Date:
- Wed Jun 27 06:51:02 2018 +0000
- Revision:
- 0:bed9e78dd09c
- Child:
- 1:60fc2072f184
1
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
nikitoslav | 0:bed9e78dd09c | 1 | #include "mbed.h" |
nikitoslav | 0:bed9e78dd09c | 2 | #include <string> |
nikitoslav | 0:bed9e78dd09c | 3 | #include "ESP8266UDPNode.h" |
nikitoslav | 0:bed9e78dd09c | 4 | |
nikitoslav | 0:bed9e78dd09c | 5 | Serial console(USBTX,USBRX); |
nikitoslav | 0:bed9e78dd09c | 6 | ESP8266UDPNode esp8266UDPNode(PF_7,PF_6); |
nikitoslav | 0:bed9e78dd09c | 7 | |
nikitoslav | 0:bed9e78dd09c | 8 | int main() { |
nikitoslav | 0:bed9e78dd09c | 9 | console.baud(9600); |
nikitoslav | 0:bed9e78dd09c | 10 | console.printf("Hello\n"); |
nikitoslav | 0:bed9e78dd09c | 11 | if (esp8266UDPNode.getOnline("Clapeyron_Industries","06737184")) { |
nikitoslav | 0:bed9e78dd09c | 12 | char* ch = esp8266UDPNode.getIPAddress(); |
nikitoslav | 0:bed9e78dd09c | 13 | console.printf("Your IP is: %c\n",ch[0]); |
nikitoslav | 0:bed9e78dd09c | 14 | console.printf("Your IP is: %s\n",ch); |
nikitoslav | 0:bed9e78dd09c | 15 | } |
nikitoslav | 0:bed9e78dd09c | 16 | else |
nikitoslav | 0:bed9e78dd09c | 17 | console.printf("Can not connect to the Wi-Fi router\n"); |
nikitoslav | 0:bed9e78dd09c | 18 | esp8266UDPNode.send("privetFromESP8266",17,"192.168.0.103",8000); |
nikitoslav | 0:bed9e78dd09c | 19 | } |