Dependencies:   mbed lwip

Files at this revision

API Documentation at this revision

Comitter:
chris
Date:
Fri Sep 18 17:53:52 2009 +0000
Commit message:

Changed in this revision

lwip.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
diff -r 000000000000 -r bde94a805da1 lwip.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/lwip.lib	Fri Sep 18 17:53:52 2009 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_unsupported/code/lwip/
\ No newline at end of file
diff -r 000000000000 -r bde94a805da1 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Fri Sep 18 17:53:52 2009 +0000
@@ -0,0 +1,198 @@
+#include "mbed.h"
+
+#include "HTTPServer.h"
+#include "HTTPRPC.h"
+#include "HTTPFS.h"
+
+#include "MobileLCD.h"
+#include "LIS302.h"
+#include "RFID.h"
+#include "RGBLED.h"
+#include "Servo.h"
+#include "usbhid.h"
+
+LocalFileSystem local("local");
+Serial pc(USBTX, USBRX);
+
+InterruptIn RedButton(p30,"redbutton");
+DigitalIn GreenButton(p29,"greenbutton");
+DigitalIn BlueButton(p28,"bluebutton");
+
+DigitalOut led1(LED1,"led1");
+DigitalOut led2(LED2,"led2");
+DigitalOut led3(LED3,"led3");
+DigitalOut led4(LED4,"led4");
+
+AnalogIn light(p16);
+AnalogIn pot(p20,"pot");
+
+RFID rfid (NC,p27);
+MobileLCD lcd(p11, p12, p13, p14, p15);
+LIS302 acc (p5,p6,p7,p8);
+RGBLED rgb (p24,p22,p23);
+Servo servo (p21);
+
+usbhid hid;
+
+// Function for Rising ede of RedButton
+void RedRise () { 
+    led1 = !led1;
+}
+
+
+
+
+int main() {
+
+    // Attach the interupt hander to RedButton
+    RedButton.rise(&RedRise);
+
+    // Print to LCD and the serial port
+    lcd.printf("Hello World!");
+    pc.printf("Hello World!");
+    
+
+    while (1) {
+    
+       
+// ----------------------------------
+// Accelerometer example 
+// ----------------------------------
+
+/*     
+        float x = acc.x();
+        float y = acc.y();
+        float z = acc.z();
+        lcd.locate(0,0);
+        lcd.printf("x=%0.3f      ",x);
+        lcd.locate(0,1);
+        lcd.printf("y=%0.3f      ",y);
+        lcd.locate(0,2);
+        lcd.printf("z=%0.3f      ",z);
+        wait (0.5);
+*/
+
+
+// ----------------------------------
+// RFID Example
+// ----------------------------------
+/*
+        if (rfid.readable()) {
+            int id=rfid.read();
+            lcd.cls();
+            lcd.printf("ID : %d",id);
+            
+        }
+*/
+        
+        
+// ----------------------------------
+// Accelerometer example 
+// ----------------------------------
+
+/*     
+        float x = acc.x();
+        float y = acc.y();
+        float z = acc.z();
+        lcd.locate(0,0);
+        lcd.printf("x=%0.3f      ",x);
+        lcd.locate(0,1);
+        lcd.printf("y=%0.3f      ",y);
+        lcd.locate(0,2);
+        lcd.printf("z=%0.3f      ",z);
+        wait (0.5);
+*/
+
+
+
+// ----------------------------------
+// Servo example 
+// ----------------------------------
+/*
+        servo=pot;
+        wait (0.01);
+*/        
+        
+// ----------------------------------
+// RGB LED example with accelerometer
+// ----------------------------------
+/*
+        rgb.red(abs(acc.x()));      
+        rgb.green(abs(acc.y()));      
+        rgb.blue(abs(acc.z()));      
+*/
+        
+        
+// ----------------------------------
+// Light sensor example
+// ----------------------------------
+/*
+        lcd.locate(0,0);
+        lcd.printf("Light: %.2f ",light.read());
+        wait (0.2);                
+*/
+
+
+// ----------------------------------
+// USB HID
+// ----------------------------------
+/*
+    if (rfid.readable()) {
+        int id;
+        char msg[25];
+        id = rfid.read();
+        sprintf(msg,"Tag ID : %d\n",id);
+        hid.keyboard(msg);    
+    }
+
+*/
+
+
+
+// ----------------------------------
+// RPC over ethernet
+// ----------------------------------
+
+
+  // Create a HTTPServer on default Port
+  HTTPServer *http = new HTTPServer();
+  // Register RPC in /rpc space 
+  http->addHandler(new HTTPRPC());
+  // HTTP File system  
+  http->addHandler(new HTTPFileSystemHandler("/", "/local/"));
+  // Register the HTTPServer on the Network device (will hopfully disappear in the next Version)
+  http->bind();
+
+  NetServer *net = NetServer::get();
+  
+  lcd.locate(0,1);
+  lcd.printf("%hhu.%hhu.%hhu.%hhu", (net->getIPAddr().addr)&0xFF, (net->getIPAddr().addr>>8)&0xFF, (net->getIPAddr().addr>>16)&0xFF, (net->getIPAddr().addr>>24)&0xFF);
+
+  while(1) {
+      http->poll();
+    }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+  
+  
+  
+  
+  
+    }
+   
+  
+}
+
+
diff -r 000000000000 -r bde94a805da1 mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Fri Sep 18 17:53:52 2009 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/f63353af7be8