![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
qsdasd
main.cpp@1:1c1802ec42a2, 2012-08-17 (annotated)
- Committer:
- samux
- Date:
- Fri Aug 17 16:20:13 2012 +0000
- Revision:
- 1:1c1802ec42a2
- Parent:
- 0:1b0dc7de9db7
- Child:
- 3:9bd22e5386cd
change hello world program
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
samux | 1:1c1802ec42a2 | 1 | #include "mbed.h" |
samux | 1:1c1802ec42a2 | 2 | #include "EthernetInterface.h" |
samux | 1:1c1802ec42a2 | 3 | #include "Websocket.h" |
samux | 1:1c1802ec42a2 | 4 | |
samux | 1:1c1802ec42a2 | 5 | |
samux | 1:1c1802ec42a2 | 6 | int main() { |
samux | 1:1c1802ec42a2 | 7 | char recv[30]; |
samux | 1:1c1802ec42a2 | 8 | |
samux | 1:1c1802ec42a2 | 9 | EthernetInterface eth; |
samux | 1:1c1802ec42a2 | 10 | eth.init(); //Use DHCP |
samux | 1:1c1802ec42a2 | 11 | eth.connect(); |
samux | 1:1c1802ec42a2 | 12 | printf("IP Address is %s\n\r", eth.getIPAddress()); |
samux | 1:1c1802ec42a2 | 13 | |
samux | 1:1c1802ec42a2 | 14 | Websocket ws("ws://sockets.mbed.org:443/ws/demo/wo"); |
samux | 1:1c1802ec42a2 | 15 | ws.connect(); |
samux | 1:1c1802ec42a2 | 16 | |
samux | 1:1c1802ec42a2 | 17 | while (1) { |
samux | 1:1c1802ec42a2 | 18 | ws.send("WebSocket Hello World over Ethernet"); |
samux | 1:1c1802ec42a2 | 19 | wait(1.0); |
samux | 1:1c1802ec42a2 | 20 | } |
samux | 1:1c1802ec42a2 | 21 | } |