Example code for ADC Workshop IEEE TAMU

Dependencies:   mbed

Revision:
0:3ac4b3f82983
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
+    }
+}
+