Example code for ADC Workshop IEEE TAMU

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
matthewrdestefano
Date:
Fri Apr 03 21:08:30 2015 +0000
Commit message:
ADC Workshop V1;

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.lib Show annotated file Show diff for this revision Revisions of this file
diff -r 000000000000 -r 3ac4b3f82983 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Fri Apr 03 21:08:30 2015 +0000
@@ -0,0 +1,12 @@
+#include "mbed.h"
+AnalogIn voltage(PTB0); // set the analog input to pin PTB0
+
+int main(void) {
+    
+    PwmOut led(LED_GREEN); // set green LED as PWM output
+    while (true) // infinite loop
+    {
+        led = 1.0 - voltage.read(); // update the LED brightness with ADC data
+    }
+}
+
diff -r 000000000000 -r 3ac4b3f82983 mbed.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.lib	Fri Apr 03 21:08:30 2015 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/#9ad691361fac