Example code for ADC Workshop IEEE TAMU

Dependencies:   mbed

main.cpp

Committer:
matthewrdestefano
Date:
2015-04-03
Revision:
0:3ac4b3f82983

File content as of revision 0:3ac4b3f82983:

#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
    }
}