Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
main.cpp
00001 #include "mbed.h" 00002 00003 Serial pc(USBTX, USBRX); // tx, rx 00004 PwmOut led(PA_7); 00005 00006 float brightness = 0.0; 00007 00008 int main() { 00009 pc.printf("Press 'u' to turn LED1 brightness up, 'd' to turn it down\n"); 00010 00011 while(1) { 00012 char c = pc.getc(); 00013 if((c == 'u') && (brightness < 0.5)) { 00014 brightness += 0.01; 00015 led = brightness; 00016 } 00017 if((c == 'd') && (brightness > 0.0)) { 00018 brightness -= 0.01; 00019 led = brightness; 00020 } 00021 00022 } 00023 }
Generated on Tue Jul 12 2022 21:13:57 by
1.7.2