read analog val to change the brig of the LED

  1. include "mbed.h" include mbed library

AnalogIn Pot(PC_1);

PwmOut LedRgbGrn(PB_0);

PwmOut LedRgbBlu(PB_1);

PwmOut LedRgbRed(PB_5);

int main() { LedRgbGrn.period(0.8);

LedRgbBlu.period(0.58); LedRgbRed.period(0.58);

while(1) { LedRgbGrn.write(Pot.read());

LedRgbBlu = Pot;

LedRgbRed = Pot;

} }


Please log in to post comments.