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
Fork of DISCO_SMT32L4_pwm_PB3 by
Revision 7:662af5825808, committed 2018-04-26
- Comitter:
- carter7778
- Date:
- Thu Apr 26 02:24:38 2018 +0000
- Parent:
- 6:57bad75ec95b
- Commit message:
- Last and final version...maybe
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 57bad75ec95b -r 662af5825808 main.cpp --- a/main.cpp Wed Apr 25 00:21:14 2018 +0000 +++ b/main.cpp Thu Apr 26 02:24:38 2018 +0000 @@ -2,7 +2,7 @@ Serial pc(SERIAL_TX, SERIAL_RX); PwmOut mypwm(PWM_OUT); // PB3 - blue PwmOut red_pwm(LED1); // PE8-red -PwmOut green_pwm(JOYSTICK_LEFT);// PA1 GREEN +PwmOut green_pwm(PB_6);// PA1 GREEN #define UP 1 @@ -34,7 +34,7 @@ count_dir = UP; } } - printf("pwm set to %.2f %%\n\r", mypwm.read() * 100); + printf("blue set to %.2f %%\n\r", mypwm.read() * 100); } if(a =='d') { @@ -69,7 +69,7 @@ count_dir = UP; } } - printf("pwm set to %.2f %%\n\r", red_pwm.read() * 100); + printf("red set to %.2f %%\n\r", red_pwm.read() * 100); } if(a =='d') { @@ -104,7 +104,7 @@ count_dir = UP; } } - printf("pwm set to %.2f %%\n\r", green_pwm.read() * 100); + printf("green set to %.2f %%\n\r", green_pwm.read() * 100); } if(a =='d') { @@ -140,8 +140,8 @@ count_dir = UP; } } - printf("pwm set to %.2f %%\n\r", mypwm.read() * 100); - printf("2nd pwm set to %.2f %%\n\r", red_pwm.read() * 100); + printf("blue set to %.2f %%\n\r", mypwm.read() * 100); + printf("red pwm set to %.2f %%\n\r", red_pwm.read() * 100); } if(a =='d') { @@ -177,8 +177,8 @@ count_dir = UP; } } - printf("pwm set to %.2f %%\n\r", mypwm.read() * 100); - printf("2nd pwm set to %.2f %%\n\r", green_pwm.read() * 100); + printf("blue set to %.2f %%\n\r", mypwm.read() * 100); + printf("green pwm set to %.2f %%\n\r", green_pwm.read() * 100); } if(a =='d') { @@ -214,8 +214,8 @@ count_dir = UP; } } - printf("pwm set to %.2f %%\n\r", green_pwm.read() * 100); - printf("2nd pwm set to %.2f %%\n\r", red_pwm.read() * 100); + printf("green set to %.2f %%\n\r", green_pwm.read() * 100); + printf("red set to %.2f %%\n\r", red_pwm.read() * 100); } if(a =='d') { @@ -253,9 +253,9 @@ count_dir = UP; } } - printf("pwm set to %.2f %%\n\r", mypwm.read() * 100); - printf("2nd pwm set to %.2f %%\n\r", red_pwm.read() * 100); - printf("3rd pwm set to %.2f %%\n\r", green_pwm.read() * 100); + printf("blue set to %.2f %%\n\r", mypwm.read() * 100); + printf("red pwm set to %.2f %%\n\r", red_pwm.read() * 100); + printf("green pwm set to %.2f %%\n\r", green_pwm.read() * 100); } if(a =='d') { @@ -276,19 +276,25 @@ green_pwm.pulsewidth_ms(1); count_dir = UP; - pc.printf("Press '7' for White, Press '6' for Orange, Press '5' for Yellow, Press '4' for Green, Press '3' for Red, Press '2 for Purple, Press '1' for Blue, '0' to turn it OFF\n\r"); + pc.printf("Press '7' for White \n\r, Press '6' for Yellow \n\r, Press '5' for Blue/Green \n\r, Press '4' for Green \n\r, Press '3' for Red \n\r, Press '2 for Purple \n\r, Press '1' for Blue\n\r, '0' to turn it OFF\n\r"); while(loop== 1) { - /* + mypwm=0; red_pwm=0; green_pwm=0; - */ + char c = pc.getc(); // Read hyperterminal - if (c == 'o') { + if (c == '0') { mypwm=0; red_pwm=0; green_pwm=0; + loop==0; + printf("Program Completed. Have a nice day!\n\r"); + printf("Program Completed. Have a nice day!\n\r"); + printf("Program Completed. Have a nice day!\n\r"); + printf("Program Completed. Have a nice day!\n\r"); + printf("Program Completed. Have a nice day!\n\r"); } if (c == '1') { @@ -351,10 +357,11 @@ loop=0; } if (c == 'h'){ - pc.printf("Press '7' for White, Press '6' for Orange, Press '5' for Yellow, Press '4' for Green, Press '3' for Red, Press '2 for Purple, Press '1' for Blue, '0' to turn it OFF\n\r"); + pc.printf("Press '7' for White \n\r, Press '6' for Yellow \n\r, Press '5' for Blue/Green \n\r, Press '4' for Green \n\r, Press '3' for Red \n\r, Press '2 for Purple \n\r, Press '1' for Blue\n\r, '0' to turn it OFF\n\r"); } } + }