Seeedstudio Arch Examples : Analog - Potentiometer example

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
viswesr
Date:
Mon Oct 07 05:36:52 2013 +0000
Child:
1:f81ab0473843
Commit message:
First version

Changed in this revision

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/main.cpp	Mon Oct 07 05:36:52 2013 +0000
@@ -0,0 +1,17 @@
+#include "mbed.h"
+
+AnalogIn pot(P0_11);   /* Potentiometer middle pin connected to P0_11, other two ends connected to GND and 3.3V */
+DigitalOut led(LED1);  /* LED blinks with a delay based on the analog input read */
+
+int main()
+{
+    float ain;
+
+    while(1) {
+        ain = pot.read(); /* Read analog value (output will be any value between 0 and 1 */
+        led = 1;          /* Switch ON LED        */  
+        wait(ain);        /* Wait for ain Seconds (maximum delay is 1 seconds)*/ 
+        led = 0;          /* Switch Off LED       */    
+        wait(ain);        /* Wait for ain Seconds (maximum delay is 1 seconds)*/ 
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Mon Oct 07 05:36:52 2013 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/a9913a65894f
\ No newline at end of file