sho hashimoto
/
tweet_test
tweet test
main.cpp@0:660f9590d2db, 2010-04-21 (annotated)
- Committer:
- shokai
- Date:
- Wed Apr 21 13:27:36 2010 +0000
- Revision:
- 0:660f9590d2db
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
shokai | 0:660f9590d2db | 1 | #include "mbed.h" |
shokai | 0:660f9590d2db | 2 | #include "HTTPClient.h" |
shokai | 0:660f9590d2db | 3 | using namespace std; |
shokai | 0:660f9590d2db | 4 | |
shokai | 0:660f9590d2db | 5 | DigitalOut led(LED1); |
shokai | 0:660f9590d2db | 6 | |
shokai | 0:660f9590d2db | 7 | HTTPClient http; // use DHCP |
shokai | 0:660f9590d2db | 8 | |
shokai | 0:660f9590d2db | 9 | /* // use static IP |
shokai | 0:660f9590d2db | 10 | HTTPClient http("mbed", // hostname. |
shokai | 0:660f9590d2db | 11 | IPv4(192,168,1,39), // IPv4 address |
shokai | 0:660f9590d2db | 12 | IPv4(255,255,255,0), // netmask |
shokai | 0:660f9590d2db | 13 | IPv4(192,168,1,1), // default gateway |
shokai | 0:660f9590d2db | 14 | IPv4(192,168,1,1)); // dns server |
shokai | 0:660f9590d2db | 15 | /**/ |
shokai | 0:660f9590d2db | 16 | |
shokai | 0:660f9590d2db | 17 | const char msg[] = "status=mbed test"; |
shokai | 0:660f9590d2db | 18 | |
shokai | 0:660f9590d2db | 19 | int main(void) { |
shokai | 0:660f9590d2db | 20 | http.auth("username", "password"); |
shokai | 0:660f9590d2db | 21 | http.post("http://twitter.com/statuses/update.xml", msg); |
shokai | 0:660f9590d2db | 22 | |
shokai | 0:660f9590d2db | 23 | while(1) { |
shokai | 0:660f9590d2db | 24 | led = !led; |
shokai | 0:660f9590d2db | 25 | wait(0.2); |
shokai | 0:660f9590d2db | 26 | } |
shokai | 0:660f9590d2db | 27 | } |