Akshay Kulkarni
/
frdm_dutycycle
This code explains the duty cycle changing process by which we can change the speed of the motor
Revision 0:82a1db9f5a98, committed 2016-05-06
- Comitter:
- Akshayiupui
- Date:
- Fri May 06 23:46:33 2016 +0000
- Commit message:
- FRDM DUTY CYCLE SPEED CONTROL
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
mbed.bld | Show annotated file Show diff for this revision Revisions of this file |
diff -r 000000000000 -r 82a1db9f5a98 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Fri May 06 23:46:33 2016 +0000 @@ -0,0 +1,32 @@ +#include "mbed.h" + +DigitalOut vcc(PTC16); +int i; + + +int main() +{ + +printf("Press 1 for full duty cycle\r\n",i); +printf("Press 2 for 75% duty cycle\r\n",i); +printf("Press 3 for 50% cycle\r\n",i); +printf("Press 4 for 25% cycle\r\n",i); +scanf("%d\n",&i); +printf("i= %d\n",i); + +while(i==1){vcc=!vcc;} +while(i==2){vcc=!vcc; +wait(0.75); +vcc=0; +wait(0.25);} + +while(i==3){vcc=!vcc; +wait(0.5); +vcc=0; +wait(0.5);} + +while(i==4){vcc=!vcc; +wait(0.25); +vcc=0; +wait(0.75);} +}
diff -r 000000000000 -r 82a1db9f5a98 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Fri May 06 23:46:33 2016 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/aae6fcc7d9bb \ No newline at end of file