![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
CodeShare
Dependencies: mbed
Diff: main.cpp
- Revision:
- 0:3a5416fc52a1
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Sun Sep 25 20:19:50 2016 +0000 @@ -0,0 +1,26 @@ +#include "mbed.h" + +PwmOut GREEN(p22); // normal LED +PwmOut BLUE(p21); // normal LED + +AnalogIn AinBLUE(p20); +AnalogIn AinGREEN(p19); + + +int main() +{ + float dcBLUE; // 50% duty cycle + float dcGREEN; + + GREEN.period(0.01f); // 0.01 second period + BLUE.period(0.01f); // 0.01 second period + + while (1) { + dcBLUE = 0.5*AinBLUE; + dcGREEN = 0.5*AinGREEN; + BLUE.write(dcBLUE); + GREEN.write(dcGREEN); + wait(0.1); + } + return 0; +} \ No newline at end of file