Tim Johnson
/
4_LED_bounce
The 4 LEDs are exercised one at a time moving one way then the other at the end of the row.
main.cpp@0:a97a819083e9, 2015-12-16 (annotated)
- Committer:
- captaintim
- Date:
- Wed Dec 16 21:35:17 2015 +0000
- Revision:
- 0:a97a819083e9
The 4 LEDs are exercised by lighting one LED at a time moving in one direction until it reaches the end of the row then reversing.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
captaintim | 0:a97a819083e9 | 1 | #include "mbed.h" |
captaintim | 0:a97a819083e9 | 2 | |
captaintim | 0:a97a819083e9 | 3 | /*comments testing lighting of 4 LEDs bouncing*/ |
captaintim | 0:a97a819083e9 | 4 | |
captaintim | 0:a97a819083e9 | 5 | int main() { |
captaintim | 0:a97a819083e9 | 6 | int on = 1; |
captaintim | 0:a97a819083e9 | 7 | int off = 0; |
captaintim | 0:a97a819083e9 | 8 | while(1){ |
captaintim | 0:a97a819083e9 | 9 | |
captaintim | 0:a97a819083e9 | 10 | DigitalOut (LED1, on); |
captaintim | 0:a97a819083e9 | 11 | wait (.2); |
captaintim | 0:a97a819083e9 | 12 | |
captaintim | 0:a97a819083e9 | 13 | DigitalOut (LED1, off); |
captaintim | 0:a97a819083e9 | 14 | DigitalOut (LED2, on); |
captaintim | 0:a97a819083e9 | 15 | wait (.2); |
captaintim | 0:a97a819083e9 | 16 | |
captaintim | 0:a97a819083e9 | 17 | DigitalOut (LED2, off); |
captaintim | 0:a97a819083e9 | 18 | DigitalOut (LED3, on); |
captaintim | 0:a97a819083e9 | 19 | wait (.2); |
captaintim | 0:a97a819083e9 | 20 | |
captaintim | 0:a97a819083e9 | 21 | DigitalOut (LED3, off); |
captaintim | 0:a97a819083e9 | 22 | DigitalOut (LED4, on); |
captaintim | 0:a97a819083e9 | 23 | wait (.2); |
captaintim | 0:a97a819083e9 | 24 | |
captaintim | 0:a97a819083e9 | 25 | DigitalOut (LED4, off); |
captaintim | 0:a97a819083e9 | 26 | DigitalOut (LED3, on); |
captaintim | 0:a97a819083e9 | 27 | wait (.2); |
captaintim | 0:a97a819083e9 | 28 | |
captaintim | 0:a97a819083e9 | 29 | DigitalOut (LED3, off); |
captaintim | 0:a97a819083e9 | 30 | DigitalOut (LED2, on); |
captaintim | 0:a97a819083e9 | 31 | wait (.2); |
captaintim | 0:a97a819083e9 | 32 | |
captaintim | 0:a97a819083e9 | 33 | DigitalOut (LED2, off); |
captaintim | 0:a97a819083e9 | 34 | } |
captaintim | 0:a97a819083e9 | 35 | } |