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.
main.cpp
00001 #include "mbed.h" 00002 Serial pc(PA_2, PA_3,115200); //tx, rx 00003 PwmOut led(PA_0); 00004 float brightness=0.0; 00005 00006 int main() 00007 { 00008 pc.printf("control of LED dimmer by host terminal\n\r"); 00009 pc.printf("Press 'u' = brighter, 'd' = dimmer\n\r"); 00010 while (1) { 00011 char c = pc.getc(); 00012 wait(0.001); 00013 if((c == 'u') && (brightness < 1)) { 00014 brightness += 0.1; 00015 motor= brightness; 00016 } 00017 if(( c == 'd') && (brightness > 0)) { 00018 brightness -= 0.1; 00019 motor = brightness; 00020 } 00021 00022 pc.printf("%c %1.3f \n \r",c,brightness); 00023 00024 } 00025 } 00026
Generated on Thu Jul 21 2022 20:12:34 by
1.7.2