Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of pump_controller by
main.cpp@0:4f21cc600d24, 2013-12-14 (annotated)
- Committer:
- sandwich
- Date:
- Sat Dec 14 23:54:59 2013 +0000
- Revision:
- 0:4f21cc600d24
- Child:
- 1:230b384225c7
first commit
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| sandwich | 0:4f21cc600d24 | 1 | #include "mbed.h" |
| sandwich | 0:4f21cc600d24 | 2 | |
| sandwich | 0:4f21cc600d24 | 3 | DigitalOut outA(p21), outB(p22); |
| sandwich | 0:4f21cc600d24 | 4 | PwmOut pwm(p23); |
| sandwich | 0:4f21cc600d24 | 5 | |
| sandwich | 0:4f21cc600d24 | 6 | int main(void) |
| sandwich | 0:4f21cc600d24 | 7 | { |
| sandwich | 0:4f21cc600d24 | 8 | outA=0; |
| sandwich | 0:4f21cc600d24 | 9 | outB=1; |
| sandwich | 0:4f21cc600d24 | 10 | float out=0; |
| sandwich | 0:4f21cc600d24 | 11 | while (1) { |
| sandwich | 0:4f21cc600d24 | 12 | pwm.write(out); |
| sandwich | 0:4f21cc600d24 | 13 | out+=0.1f; |
| sandwich | 0:4f21cc600d24 | 14 | if (out>=1.0f) { |
| sandwich | 0:4f21cc600d24 | 15 | out=0; |
| sandwich | 0:4f21cc600d24 | 16 | } |
| sandwich | 0:4f21cc600d24 | 17 | wait(0.5); |
| sandwich | 0:4f21cc600d24 | 18 | } |
| sandwich | 0:4f21cc600d24 | 19 | return 0; |
| sandwich | 0:4f21cc600d24 | 20 | } |
