Augusto Panecatl
/
GPIO_RGB
GPIO + IRQ code example for FRDM-KL25Z
main.cpp@0:9bb80fc4800d, 2014-06-04 (annotated)
- Committer:
- APanecatl
- Date:
- Wed Jun 04 19:22:26 2014 +0000
- Revision:
- 0:9bb80fc4800d
Rev 1.0
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
APanecatl | 0:9bb80fc4800d | 1 | #include "mbed.h" |
APanecatl | 0:9bb80fc4800d | 2 | |
APanecatl | 0:9bb80fc4800d | 3 | //Delay declared in seconds |
APanecatl | 0:9bb80fc4800d | 4 | |
APanecatl | 0:9bb80fc4800d | 5 | DigitalOut Red(LED1); |
APanecatl | 0:9bb80fc4800d | 6 | DigitalOut Green(LED2); |
APanecatl | 0:9bb80fc4800d | 7 | DigitalOut Blue(LED3); |
APanecatl | 0:9bb80fc4800d | 8 | DigitalIn enable(PTB11, PullUp); |
APanecatl | 0:9bb80fc4800d | 9 | |
APanecatl | 0:9bb80fc4800d | 10 | |
APanecatl | 0:9bb80fc4800d | 11 | int main() |
APanecatl | 0:9bb80fc4800d | 12 | { |
APanecatl | 0:9bb80fc4800d | 13 | while(1) |
APanecatl | 0:9bb80fc4800d | 14 | { |
APanecatl | 0:9bb80fc4800d | 15 | if(enable) |
APanecatl | 0:9bb80fc4800d | 16 | { |
APanecatl | 0:9bb80fc4800d | 17 | Red = 0; |
APanecatl | 0:9bb80fc4800d | 18 | wait(.2); |
APanecatl | 0:9bb80fc4800d | 19 | Red = 1; |
APanecatl | 0:9bb80fc4800d | 20 | wait(1); |
APanecatl | 0:9bb80fc4800d | 21 | |
APanecatl | 0:9bb80fc4800d | 22 | Green=0; |
APanecatl | 0:9bb80fc4800d | 23 | wait(.2); |
APanecatl | 0:9bb80fc4800d | 24 | Green=1; |
APanecatl | 0:9bb80fc4800d | 25 | wait(1); |
APanecatl | 0:9bb80fc4800d | 26 | |
APanecatl | 0:9bb80fc4800d | 27 | Blue=0; |
APanecatl | 0:9bb80fc4800d | 28 | wait(.2); |
APanecatl | 0:9bb80fc4800d | 29 | Blue=1; |
APanecatl | 0:9bb80fc4800d | 30 | wait(1); |
APanecatl | 0:9bb80fc4800d | 31 | } |
APanecatl | 0:9bb80fc4800d | 32 | } |
APanecatl | 0:9bb80fc4800d | 33 | } |