This allows an LPC1768 to take Art-Net data and send it to WS2812B LED's

Dependencies:   mbed mbed-rtos EthernetInterface

Committer:
donatien
Date:
Tue Jun 26 15:34:26 2012 +0000
Revision:
1:e2652bd064c6
Parent:
0:bb128f0e952f
Child:
2:e087e9b789e9
Switched from uint8_t* to char* for data type

Who changed what in which revision?

UserRevisionLine numberNew contents of line
donatien 0:bb128f0e952f 1 #include "mbed.h"
donatien 0:bb128f0e952f 2 #include "EthernetInterface.h"
donatien 0:bb128f0e952f 3
donatien 0:bb128f0e952f 4 int main()
donatien 0:bb128f0e952f 5 {
donatien 0:bb128f0e952f 6 EthernetInterface eth;
donatien 0:bb128f0e952f 7 eth.init(); //Use DHCP
donatien 0:bb128f0e952f 8
donatien 0:bb128f0e952f 9 eth.connect();
donatien 0:bb128f0e952f 10
donatien 0:bb128f0e952f 11 TCPSocket sock;
donatien 0:bb128f0e952f 12 sock.connect("mbed.org", 80);
donatien 0:bb128f0e952f 13
donatien 1:e2652bd064c6 14 char http_cmd[] = "GET /media/uploads/donatien/hello.txt HTTP/1.1\r\nHost: %s\r\n\r\n";
donatien 1:e2652bd064c6 15 sock.send(http_cmd, sizeof(http_cmd) - 1, 3000);
donatien 0:bb128f0e952f 16
donatien 0:bb128f0e952f 17 char in_buf[256];
donatien 0:bb128f0e952f 18 bool firstIteration = true;
donatien 0:bb128f0e952f 19 int ret;
donatien 0:bb128f0e952f 20 do
donatien 0:bb128f0e952f 21 {
donatien 1:e2652bd064c6 22 ret = sock.receive(in_buf, 255, firstIteration?3000:0);
donatien 0:bb128f0e952f 23 in_buf[ret] = '\0';
donatien 0:bb128f0e952f 24
donatien 0:bb128f0e952f 25 printf("Received %d chars from server: %s\n", ret, in_buf);
donatien 0:bb128f0e952f 26 firstIteration = false;
donatien 0:bb128f0e952f 27 } while( ret > 0 );
donatien 0:bb128f0e952f 28
donatien 0:bb128f0e952f 29 sock.close();
donatien 0:bb128f0e952f 30
donatien 0:bb128f0e952f 31 eth.disconnect();
donatien 0:bb128f0e952f 32
donatien 0:bb128f0e952f 33 while(1) {
donatien 0:bb128f0e952f 34 }
donatien 0:bb128f0e952f 35 }