Four LEDs are turned on and off at a constant rate.
Dependencies: mbed
This is the first program you should try on mbed + LPC1768. Two LEDs should be attached outside of the board. Connect the longer leads of two LEDs to p22 and p23, and the shorter leads to GND.
multi_blinky.cpp@0:08244a723eff, 2018-04-01 (annotated)
- Committer:
- titanium
- Date:
- Sun Apr 01 04:51:36 2018 +0000
- Revision:
- 0:08244a723eff
multiple led blinky;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
titanium | 0:08244a723eff | 1 | #include "mbed.h" |
titanium | 0:08244a723eff | 2 | |
titanium | 0:08244a723eff | 3 | DigitalOut digled1(LED1), digled2(LED2); |
titanium | 0:08244a723eff | 4 | DigitalOut digled3(p22), digled4(p23); |
titanium | 0:08244a723eff | 5 | |
titanium | 0:08244a723eff | 6 | int main() { |
titanium | 0:08244a723eff | 7 | while(1) { |
titanium | 0:08244a723eff | 8 | digled1= !digled1; |
titanium | 0:08244a723eff | 9 | digled2= !digled2; |
titanium | 0:08244a723eff | 10 | digled3= !digled3; |
titanium | 0:08244a723eff | 11 | digled4= !digled4; |
titanium | 0:08244a723eff | 12 | wait(1.0); |
titanium | 0:08244a723eff | 13 | } } |
titanium | 0:08244a723eff | 14 |