Rolf Meyer
/
Twitter
This is a simple lwip HTTPClient example it uses the HTTPClient class to update your twitter status.
main.cpp@1:803d5168d739, 2009-12-02 (annotated)
- Committer:
- rolf
- Date:
- Wed Dec 02 12:22:40 2009 +0000
- Revision:
- 1:803d5168d739
- Parent:
- 0:5396f623478b
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
rolf | 0:5396f623478b | 1 | #include "mbed.h" |
rolf | 0:5396f623478b | 2 | #include "HTTPClient.h" |
rolf | 0:5396f623478b | 3 | |
rolf | 0:5396f623478b | 4 | DigitalOut led(LED1); |
rolf | 0:5396f623478b | 5 | HTTPClient http; |
rolf | 0:5396f623478b | 6 | |
rolf | 1:803d5168d739 | 7 | #error Insert username and password |
rolf | 1:803d5168d739 | 8 | const char user[] = "<your twitter username>"; |
rolf | 1:803d5168d739 | 9 | const char pass[] = "<your twitter password>"; |
rolf | 1:803d5168d739 | 10 | const char msg[] = "status=Hello World from an mbed"; |
rolf | 0:5396f623478b | 11 | const char url[] = "http://twitter.com/statuses/update.xml"; |
rolf | 0:5396f623478b | 12 | |
rolf | 0:5396f623478b | 13 | int main(void) { |
rolf | 0:5396f623478b | 14 | http.auth(user, pass); |
rolf | 0:5396f623478b | 15 | http.post(url, msg, stdout); |
rolf | 0:5396f623478b | 16 | |
rolf | 0:5396f623478b | 17 | while(1) { |
rolf | 0:5396f623478b | 18 | led = !led; |
rolf | 0:5396f623478b | 19 | wait(0.2); |
rolf | 0:5396f623478b | 20 | } |
rolf | 0:5396f623478b | 21 | } |