Controlling DC motor using power MOSFET
Dependencies: mbed
main.cpp@0:2366bfc35e27, 2018-02-14 (annotated)
- Committer:
- Nydrel
- Date:
- Wed Feb 14 08:59:17 2018 +0000
- Revision:
- 0:2366bfc35e27
- Child:
- 1:f5e6f3468ec3
Changed GPIO pin to p21;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Nydrel | 0:2366bfc35e27 | 1 | #include "mbed.h" |
Nydrel | 0:2366bfc35e27 | 2 | |
Nydrel | 0:2366bfc35e27 | 3 | DigitalOut myled(LED1); |
Nydrel | 0:2366bfc35e27 | 4 | DigitalOut Ctrl(p21); |
Nydrel | 0:2366bfc35e27 | 5 | |
Nydrel | 0:2366bfc35e27 | 6 | int main() { |
Nydrel | 0:2366bfc35e27 | 7 | while(1) { |
Nydrel | 0:2366bfc35e27 | 8 | Ctrl = 1; |
Nydrel | 0:2366bfc35e27 | 9 | myled = 1; |
Nydrel | 0:2366bfc35e27 | 10 | wait(.2); |
Nydrel | 0:2366bfc35e27 | 11 | Ctrl = 0; |
Nydrel | 0:2366bfc35e27 | 12 | myled = 0; |
Nydrel | 0:2366bfc35e27 | 13 | wait(.2); |
Nydrel | 0:2366bfc35e27 | 14 | } |
Nydrel | 0:2366bfc35e27 | 15 | } |