Dependencies:   EthernetNetIf mbed

Files at this revision

API Documentation at this revision

Comitter:
donatien
Date:
Thu Jun 17 09:21:41 2010 +0000
Child:
1:318a00501839
Commit message:

Changed in this revision

EthernetNetIf.lib Show annotated file Show diff for this revision Revisions of this file
HTTPClient.lib Show annotated file Show diff for this revision Revisions of this file
ID12RFID.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/EthernetNetIf.lib	Thu Jun 17 09:21:41 2010 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/donatien/code/EthernetNetIf/#bc7df6da7589
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/HTTPClient.lib	Thu Jun 17 09:21:41 2010 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/donatien/code/HTTPClient/#d97a4fc01c86
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ID12RFID.lib	Thu Jun 17 09:21:41 2010 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/simon/code/ID12RFID/#f04afa911cf5
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Thu Jun 17 09:21:41 2010 +0000
@@ -0,0 +1,40 @@
+// RFID Tweeter
+
+#include "mbed.h"
+#include "ID12RFID.h"
+#include "EthernetNetIf.h"
+#include "HTTPClient.h"
+
+#define TWITTER_USER "donatiengarnier"
+#define TWITTER_PASSWORD "myverysecurepassword"
+
+#define IDS_COUNT 3
+const int ids_list[IDS_COUNT] = {89481809, 89481810, 89481811};
+const char* names_list[IDS_COUNT] = {"Donatien", "Simon", "Dan"};
+
+EthernetNetIf ethernet;
+HTTPClient twitter;
+
+ID12RFID rfid(p14);
+DigitalOut tag_present(LED1);
+DigitalOut tweet_ok(LED4);
+
+int main() {
+  ethernet.setup();
+  twitter.basicAuth(TWITTER_USER, TWITTER_PASSWORD);
+
+  while(true) {
+    int id = rfid.read();
+    tag_present = 1;
+    for(int i = 0; i < IDS_COUNT; i++) {
+      if (ids_list[i] == id) {
+        HTTPMap msg;
+        msg["status"] = names_list[i];
+        msg["status"] += " just arrived home!";
+        HTTPResult r = twitter.post("http://twitter.com/statuses/update.xml", msg, NULL);
+        tweet_ok = !r;
+      }
+    }
+    tag_present = 0;
+  }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Thu Jun 17 09:21:41 2010 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/029aa53d7323