mbed Demo Display that shows several of the features
Dependencies: MSCUsbHost mbed Servo SRF08
Revision 0:aef73ca5c41c, committed 2010-09-20
- Comitter:
- demo
- Date:
- Mon Sep 20 21:14:34 2010 +0000
- Commit message:
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/FATFileSystem.lib Mon Sep 20 21:14:34 2010 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_unsupported/code/fatfilesystem/ \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ID12RFID.lib Mon Sep 20 21:14:34 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/MSCUsbHost.lib Mon Sep 20 21:14:34 2010 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/chris/code/MSCUsbHost/#cfb58054ab28
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/SRF08.lib Mon Sep 20 21:14:34 2010 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/chris/code/SRF08/#ba04e9cd48fc
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Servo.lib Mon Sep 20 21:14:34 2010 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/simon/code/Servo/#36b69a7ced07
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Mon Sep 20 21:14:34 2010 +0000 @@ -0,0 +1,46 @@ +#include "mbed.h" +#include "SRF08.h" +#include "Servo.h" +#include "ID12RFID.h" + +DigitalOut led1(LED1); +DigitalOut led2(LED2); +PwmOut led3(LED3); + +SRF08 srf08(p28, p27, 0xE0); // Define SDA, SCL pin and I2C address +PwmOut meter (p22); +Servo servo (p21); +AnalogIn pot (p18); +ID12RFID rfid (p10); +AnalogIn th (p19); +LocalFileSystem fs ("fs"); + +int main() { + + FILE *fp = fopen("/fs/hello.txt","w"); + fprintf(fp,"Hello World!\n"); + fclose(fp); + + while (1) { + + // Check to see if an RFID tag has been presented, if so, display it + if (rfid.readable()) { + printf("ID Tag : %d\n",rfid.read()); + led1 = !led1; + } + + // If the middle pot is more than half way + // read and display from the Ultrasonic range finder + if (th.read() > 0.5) { + float measure = srf08.read(); + printf("Measured range : %.2f cm\n",measure); + meter = 1.0 - (measure/44.0); + led2 = !led2; + } + + // Move the servo to reflect the pot + servo = pot.read(); + led3.write(pot.read()); + wait(0.1); + } +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Mon Sep 20 21:14:34 2010 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/9114680c05da