Anolog in Led fader PWM out

Voltage between P20 and vin/gnd controls pwm rate (on/off time not frequency)

// Fade a led on.
#include "mbed.h"

PwmOut rate(LED2);
AnalogIn ain(p20);


int main() {
 rate.period_ms( 10 );
    while (1){
        rate = ain;
        }
        wait(0.01);
         {
        }
    }


0 comments

You need to log in to post a comment