by Rob Toulson and Tim Wilmshurst from textbook "Fast and Effective Embedded Systems Design: Applying the ARM mbed"
main.cpp@0:f528b9c8a890, 2012-08-31 (annotated)
- Committer:
- robt
- Date:
- Fri Aug 31 15:21:52 2012 +0000
- Revision:
- 0:f528b9c8a890
by Rob Toulson and Tim Wilmshurst from textbook "Fast and Effective Embedded Systems Design: Applying the ARM mbed"
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
robt | 0:f528b9c8a890 | 1 | /*Program Example 3.2: Flashes red and green LEDs in simple time-based pattern |
robt | 0:f528b9c8a890 | 2 | */ |
robt | 0:f528b9c8a890 | 3 | #include "mbed.h" |
robt | 0:f528b9c8a890 | 4 | DigitalOut redled(p5); //define and name a digital output on pin 5 |
robt | 0:f528b9c8a890 | 5 | DigitalOut greenled(p6); //define and name a digital output on pin 6 |
robt | 0:f528b9c8a890 | 6 | |
robt | 0:f528b9c8a890 | 7 | int main() |
robt | 0:f528b9c8a890 | 8 | { |
robt | 0:f528b9c8a890 | 9 | while(1) { |
robt | 0:f528b9c8a890 | 10 | redled = 1; |
robt | 0:f528b9c8a890 | 11 | greenled = 0; |
robt | 0:f528b9c8a890 | 12 | wait(0.2); |
robt | 0:f528b9c8a890 | 13 | redled = 0; |
robt | 0:f528b9c8a890 | 14 | greenled = 1; |
robt | 0:f528b9c8a890 | 15 | wait(0.2); |
robt | 0:f528b9c8a890 | 16 | } |
robt | 0:f528b9c8a890 | 17 | } |
robt | 0:f528b9c8a890 | 18 |