Example of a program that uses the TwitPic library.
Dependencies: EthernetNetIf TwitPic mbed DNSResolver
Revision 0:4a6b01bf147d, committed 2011-02-26
- Comitter:
- treebykooba
- Date:
- Sat Feb 26 20:10:39 2011 +0000
- Child:
- 1:44a07cd54a87
- Commit message:
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/DNSResolver.lib Sat Feb 26 20:10:39 2011 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/hlipka/code/DNSResolver/#097d4993dd1e
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/EthernetNetIf.lib Sat Feb 26 20:10:39 2011 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mamezu/code/EthernetNetIf/#0f6c82fcde82
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TwitPic.lib Sat Feb 26 20:10:39 2011 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/treebykooba/code/TwitPic/#e8e33b39c3cc
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Sat Feb 26 20:10:39 2011 +0000 @@ -0,0 +1,42 @@ +#include "TwitPic.h" + +#define IMAGE_PATH "/local/image.jpg" + +const char twitpic_api_key[] = "31c45945be2638bydjua1c4d4278d9602"; + +const char consumer_key[] = "Hl1fObuUdobieyHZtsw52qg"; +const char consumer_secret[] = "7CmMt8nTTYKM2F6nPMSiC2DqFPYmKDZOUc3lvWIJsFk"; + + +const char access_token[] = "8839572789-uUjbndiYi2EOutUvsMYkJNcK9JtRbWhU"; +const char access_token_secret[] = "kLXd6xmIkdTS098Jb97EOBHCZkIyOZCxlYQTdug"; + +int main() { + TwitPic twitpic(twitpic_api_key,consumer_key,consumer_secret,access_token,access_token_secret); + LocalFileSystem local("local"); + EthernetNetIf network; + + + printf("Setting up network...\n"); + EthernetErr ethErr = network.setup(); + if (ethErr) { + printf("Error %d in network setup.\n", ethErr); + return -1; + } + printf("Network Setup OK\n"); + + printf("Opening File...\n"); + FILE *img = fopen(IMAGE_PATH, "r"); + if (img == NULL) { + printf("Error in file open.\n"); + return -1; + } + printf("File open.\n"); + + int ret = twitpic.uploadAndPost("What the what?", img); + if (ret < 0) { + printf("Twitpic upload failed with error %i",ret); + return ret; + } + return 0; +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Sat Feb 26 20:10:39 2011 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/63bcd7ba4912