Simple Thing for DJ
Dependencies: WIZnet_Library mbed
Fork of SimpleThing_DJ by
Revision 5:7b21f6b1bdaa, committed 2015-06-30
- Comitter:
- ganeshgore
- Date:
- Tue Jun 30 07:22:50 2015 +0000
- Parent:
- 4:06bee14d4029
- Commit message:
- new;
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Tue Jun 30 06:43:08 2015 +0000 +++ b/main.cpp Tue Jun 30 07:22:50 2015 +0000 @@ -3,9 +3,10 @@ unsigned char MAC_Addr[6] = {0x00,0x08,0xDC,0x12,0x07,0x07}; -char* Public_Key = "0lJg1p2RXrSRqvODNmQj"; -char* Private_Key = "D6XGDjbZPdHRYABzqmVl"; +char* Public_Key = "g1WVqxqKqNtr2AVG6424TVvoyopy"; +char* Private_Key = "dRbwA0AeAWf7DqyMOdDdHzlA9Av9"; char* ServerIP = "192.168.44.70"; +int Count = 15; Serial pc(USBTX, USBRX); SPI spi(PTD2,PTD3,PTD1); @@ -19,9 +20,6 @@ pc.baud(115200); pc.printf("Start\r\n"); - char count; - - while(1) { int ret = ethernet.init(MAC_Addr); @@ -38,9 +36,7 @@ } else { pc.printf("Error ethernet.init() - ret = %d\r\n", ret); exit(0); - } - - count = 0; + } TCPSocketConnection sock; sock.connect(ServerIP, 8080); @@ -52,23 +48,16 @@ char buffer[300]; int ret_t; - - for (count=0;count<10;count++){ - char http_cmd[256]; - - sprintf(http_cmd,"GET /input/%s?private_key=%s&var1=%d HTTP/1.0\n\n",Public_Key,Private_Key,count); + char http_cmd[256]; + + sprintf(http_cmd,"GET /input/%s?private_key=%s&counter=%d HTTP/1.0\n\n",Public_Key,Private_Key,Count); + printf("Running - %s\r\n",http_cmd); sock.send_all(http_cmd, sizeof(http_cmd)-1); - while (true) { - ret_t = sock.receive(buffer, sizeof(buffer)-1); - if (ret_t <= 0) - break; - buffer[ret_t] = '\0'; - printf("Received %d chars from server:\n%s\n", ret_t, buffer); - } + ret_t = sock.receive(buffer, sizeof(buffer)-1); + buffer[ret_t] = '\0'; + printf("Received %d chars from server:\n%s\r\n", ret_t, buffer); - wait(10); - } sock.close(); ethernet.disconnect();