michael mosbach
/
panther
a little test for pwm for the motorbridge
main.cpp@0:eb28177b9e18, 2010-11-05 (annotated)
- Committer:
- moba
- Date:
- Fri Nov 05 20:35:07 2010 +0000
- Revision:
- 0:eb28177b9e18
Version .0
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
moba | 0:eb28177b9e18 | 1 | #include "mbed.h" |
moba | 0:eb28177b9e18 | 2 | |
moba | 0:eb28177b9e18 | 3 | // Fade a led on. |
moba | 0:eb28177b9e18 | 4 | |
moba | 0:eb28177b9e18 | 5 | PwmOut led1(LED1); |
moba | 0:eb28177b9e18 | 6 | PwmOut led2(LED2); |
moba | 0:eb28177b9e18 | 7 | int main() { |
moba | 0:eb28177b9e18 | 8 | while (1) { |
moba | 0:eb28177b9e18 | 9 | led2 = 1-led1; |
moba | 0:eb28177b9e18 | 10 | led1 = led1 + 0.01; |
moba | 0:eb28177b9e18 | 11 | wait(0.02); |
moba | 0:eb28177b9e18 | 12 | if (led1 == 1.0) { |
moba | 0:eb28177b9e18 | 13 | led1 = 0; |
moba | 0:eb28177b9e18 | 14 | } |
moba | 0:eb28177b9e18 | 15 | if (led2 == 0) { |
moba | 0:eb28177b9e18 | 16 | led2 = 1,0; |
moba | 0:eb28177b9e18 | 17 | } |
moba | 0:eb28177b9e18 | 18 | |
moba | 0:eb28177b9e18 | 19 | } |
moba | 0:eb28177b9e18 | 20 | } |