
Seeedstudio Arch Examples : GPIO - BusOut example
Fork of Arch_GPIO_Ex3 by
main.cpp@1:3c5f838ae76d, 2013-09-05 (annotated)
- Committer:
- viswesr
- Date:
- Thu Sep 05 06:47:44 2013 +0000
- Revision:
- 1:3c5f838ae76d
- Parent:
- 0:ed40790a022a
- Child:
- 2:d7639bb949d7
First version
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
viswesr | 0:ed40790a022a | 1 | #include "mbed.h" |
viswesr | 0:ed40790a022a | 2 | |
viswesr | 1:3c5f838ae76d | 3 | /* Configure a GPIO pin as output for controlling a LED. 'led' is a user assigned name and |
viswesr | 1:3c5f838ae76d | 4 | 'LED1' is an internal name given to a port pin P1_8 in this Arch platform. */ |
viswesr | 0:ed40790a022a | 5 | DigitalOut led(LED1); |
viswesr | 0:ed40790a022a | 6 | |
viswesr | 0:ed40790a022a | 7 | int main() |
viswesr | 0:ed40790a022a | 8 | { |
viswesr | 0:ed40790a022a | 9 | while(1) { |
viswesr | 1:3c5f838ae76d | 10 | led.write(1); // Here, DigitalOut -> write() function is used to set the ouput high. |
viswesr | 1:3c5f838ae76d | 11 | wait_ms(500); // Wait for 0.5 Seconds. The time is specified in milli-seconds using wait_ms() function. |
viswesr | 1:3c5f838ae76d | 12 | led.write(0); // Switch OFF the LED. |
viswesr | 1:3c5f838ae76d | 13 | wait_is(500000); // Wait for 0.5 Seconds. The time is specified in micro-seconds using wait_us() function. |
viswesr | 0:ed40790a022a | 14 | } |
viswesr | 0:ed40790a022a | 15 | } |