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.
simple_blinky4.cpp@1:e17f76016eaa, 2018-05-09 (annotated)
- Committer:
- titanium
- Date:
- Wed May 09 08:27:41 2018 +0000
- Revision:
- 1:e17f76016eaa
four led version;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
titanium | 1:e17f76016eaa | 1 | #include "mbed.h" |
titanium | 1:e17f76016eaa | 2 | |
titanium | 1:e17f76016eaa | 3 | DigitalOut digled1(LED1), digled2(LED2); |
titanium | 1:e17f76016eaa | 4 | DigitalOut digled3(p22), digled4(p23); |
titanium | 1:e17f76016eaa | 5 | |
titanium | 1:e17f76016eaa | 6 | int main() { |
titanium | 1:e17f76016eaa | 7 | digled1=1; digled3=1; |
titanium | 1:e17f76016eaa | 8 | while(1) { |
titanium | 1:e17f76016eaa | 9 | digled1= !digled1; |
titanium | 1:e17f76016eaa | 10 | digled2= !digled2; |
titanium | 1:e17f76016eaa | 11 | digled3= !digled3; |
titanium | 1:e17f76016eaa | 12 | digled4= !digled4; |
titanium | 1:e17f76016eaa | 13 | wait(1.0); |
titanium | 1:e17f76016eaa | 14 | } } |
titanium | 1:e17f76016eaa | 15 |