nRF51 SDK - S120 SoftDevice
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
Simple Timer Example

The Simple Timer Example demonstrates the usage of the Simple timer. It demonstrates the two modes of the module (single shot mode and repeated mode) to blink two LEDs.

When the application starts, the GPIO pins are configured as outputs to drive the LEDs. The application then uses the simple timer driver library and alternates between the two timer modes. During startup, both LEDs are lit for one second. Then the application enters single shot mode for 2 seconds before repeated timer mode is started. After 2 seconds, both LEDs are lit again and the application loops.

See the following illustration for details.

timer_example_sm.png
Simple timer example state machine

The name of the example is simple_timer_example_pca10028. If you are not using the Keil Pack Installer, you can find the source code and project file of the example in the following folder: <InstallFolder>\Nordic\nrf51\examples\peripheral\simple_timer_example

Testing

Test the Simple Timer Example application by performing the following steps:

  1. Compile and program the application.
  2. Observe that the LED state is changed as expected:
    1. Both LEDs are lit for one second.
    2. LED 1 blinks for 2 seconds.
    3. LED 2 blinks for 2 seconds.
    4. The application loops.