Controlling DC motor using power MOSFET
Dependencies: mbed
Revision 1:f5e6f3468ec3, committed 2018-02-14
- Comitter:
- Nydrel
- Date:
- Wed Feb 14 09:29:20 2018 +0000
- Parent:
- 0:2366bfc35e27
- Commit message:
- Implemented for loop and PWM to accelerate speed of the DC motor
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 2366bfc35e27 -r f5e6f3468ec3 main.cpp --- a/main.cpp Wed Feb 14 08:59:17 2018 +0000 +++ b/main.cpp Wed Feb 14 09:29:20 2018 +0000 @@ -1,15 +1,11 @@ #include "mbed.h" - -DigitalOut myled(LED1); -DigitalOut Ctrl(p21); + +PwmOut Ctrl(p21); int main() { while(1) { - Ctrl = 1; - myled = 1; - wait(.2); - Ctrl = 0; - myled = 0; - wait(.2); + float x = 0.0; x < 0; x+=0.01){ + Ctrl = x; + } } } \ No newline at end of file