`LED1'
`LED2'
`LED3'
`LED4'
The mbed test framework depends on the symbols `LED1', `LED2', `LED3', and `LED4', however the Beetle board does not include LEDs that can be drive from user applications.
To allow the mbed test framework to run unmodified on the Beetle board these LEDs are defined as being "emulated" in `PinNames.h', meaning the mbedOS GPIO driver emulates (disregards) reads and writes to those LEDs.
`PinNames.h'
This effectively means that the symbols `LED1', `LED2', `LED3', and `LED4' are RESERVED and should not be used in your code.
It is possible to drive external LEDs via the Beetle board's GPIO pins. The board supports Arduino pin configurations and will accept and Arduino R3 shield. You can also connect LEDs directly to the I/O pins via a suitable current-limiting resistor, however we recommend you respect the Arduino pin mapping shown in the image below to avoid damaging the board:
Figure 1 - Beetle board Arduino pin mapping
The standard mbed Blinky code can be modified to assign an LED to a GPIO pin as shown below:
/* File: main.cpp */ #include "mbed.h" DigitalOut led( D9 ); int main( void ) { printf( "Beetle Blinky Application\n" ); while( 1 ) { led = !led; wait_ms( 100 ); } }
The LED can then be connected to pin `D9' via a suitable current-limiting resistor:
`D9'
Figure 2 - Using an LED with the Beetle board