Akshay Kulkarni
/
frdm_dutycycle
This code explains the duty cycle changing process by which we can change the speed of the motor
main.cpp
- Committer:
- Akshayiupui
- Date:
- 2016-05-06
- Revision:
- 0:82a1db9f5a98
File content as of revision 0:82a1db9f5a98:
#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);} }