Seeedstudio Arch Examples : GPIO - Blinking LED implemented with alternate DigitalOut functions.

Dependencies:   mbed

Fork of Arch_GPIO_Ex1 by Visweswara R

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002 
00003 /* Configure a GPIO pin as output for controlling a LED. 'led' is an user assigned name and
00004  'LED1' is an internal name given to a port pin P1_8 in this Arch platform. */
00005 DigitalOut led(LED1);
00006 
00007 int main()
00008 {
00009     while(1) {
00010         led.write(1);    // Here, DigitalOut -> write() function is used to set the ouput high.
00011         wait_ms(500);    // Wait for 0.5 Seconds. The time is specified in milli-seconds using wait_ms() function.
00012         led.write(0);    // Switch OFF the LED.
00013         wait_us(500000); // Wait for 0.5 Seconds. The time is specified in micro-seconds using wait_us() function.
00014     }
00015 }