PIR sensor 2
Fork of PIRSensorWithTwitter by
Diff: WizFi310Interface.cpp
- Revision:
- 2:3194ebe06182
- Parent:
- 1:e08ea0ee2788
- Child:
- 3:8d47f7e3f9d6
--- a/WizFi310Interface.cpp Tue May 02 00:31:36 2017 +0000 +++ b/WizFi310Interface.cpp Mon Sep 18 08:11:28 2017 +0000 @@ -64,6 +64,8 @@ return cmdWLEAVE(); } + + char* WizFi310Interface::getMACAddress() { return _state.mac; @@ -83,5 +85,42 @@ { return cmdWANT(mode); } +//int WizFi310Interface::test() +//{ +// return cmdWSTATUS(); +//} + +int WizFi310Interface::test_twitter() +{ + // TCPSocketConnection(); + int errConnect; + char http_cmd[1000] = ""; + char buffer[2048] = ""; + TCPSocketConnection TCPconnection; + + char *p="arduino-tweet.appspot.com"; + int a=TCPconnection.connect(p,80); + while (true) { + if(a!=0) { + printf("\r\ncould not connect to socket : error = %d\r\n", p); + a = TCPconnection.connect(p, 80); + } else { + printf("socket connected\r\n"); + break; + } + } + + sprintf((char *)http_cmd,"GET http://arduino-tweet.appspot.com/update?token=904626807491530753-sOaChz44g9YFS7EuvRkR75l1W9T303K&status=hell\r\n"); + + TCPconnection.send_all(http_cmd, sizeof(http_cmd)); + + TCPconnection.receive_all(buffer, sizeof(buffer)); + printf("%s",buffer); + + + return 0; + } //char* getNetworkMask(); + +