![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
Relay driver circuit to control DC motor
Dependencies: mbed
Fork of 418_Lab2_Part6 by
main.cpp@0:d3908e6d31cb, 2018-02-14 (annotated)
- Committer:
- Nydrel
- Date:
- Wed Feb 14 09:04:32 2018 +0000
- Revision:
- 0:d3908e6d31cb
Changed GPIO pin to p17
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Nydrel | 0:d3908e6d31cb | 1 | #include "mbed.h" |
Nydrel | 0:d3908e6d31cb | 2 | |
Nydrel | 0:d3908e6d31cb | 3 | DigitalOut myled(LED1); |
Nydrel | 0:d3908e6d31cb | 4 | DigitalOut Ctrl(p17); |
Nydrel | 0:d3908e6d31cb | 5 | |
Nydrel | 0:d3908e6d31cb | 6 | int main() { |
Nydrel | 0:d3908e6d31cb | 7 | while(1) { |
Nydrel | 0:d3908e6d31cb | 8 | Ctrl = 1; |
Nydrel | 0:d3908e6d31cb | 9 | myled = 1; |
Nydrel | 0:d3908e6d31cb | 10 | wait(2); |
Nydrel | 0:d3908e6d31cb | 11 | Ctrl = 0; |
Nydrel | 0:d3908e6d31cb | 12 | myled = 0; |
Nydrel | 0:d3908e6d31cb | 13 | wait(2); |
Nydrel | 0:d3908e6d31cb | 14 | } |
Nydrel | 0:d3908e6d31cb | 15 | } |
Nydrel | 0:d3908e6d31cb | 16 |