Initial version. Illuminates the LED when the user button is held down. Otherwise, the LED is off. Variation on 21_Button_v5.

Committer:
mbed_official
Date:
Mon Nov 04 16:00:04 2019 +0000
Revision:
102:6979ad8bc0bc
Parent:
100:ec006d6f3cb6
Child:
104:f2805e857b14
Simplify application (#192)

The example project has been re-written to be simplified. It uses a delay within
a loop.

Runtime statistics has been removed and is only mentioned in the README. The
reader is invited to find out more. Runtime statistics is a topic on its own
and should not be implemented here.
.
Commit copied from https://github.com/ARMmbed/mbed-os-example-blinky

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mbed_official 82:abf1b1785bd7 1 /* mbed Microcontroller Library
mbed_official 102:6979ad8bc0bc 2 * Copyright (c) 2019 ARM Limited
mbed_official 82:abf1b1785bd7 3 * SPDX-License-Identifier: Apache-2.0
mbed_official 82:abf1b1785bd7 4 */
mbed_official 82:abf1b1785bd7 5
Jonathan Austin 0:2757d7abb7d9 6 #include "mbed.h"
mbed_official 100:ec006d6f3cb6 7 #include "platform/mbed_thread.h"
Jonathan Austin 0:2757d7abb7d9 8
Jonathan Austin 0:2757d7abb7d9 9
mbed_official 102:6979ad8bc0bc 10 // Blinking rate in milliseconds
mbed_official 102:6979ad8bc0bc 11 #define BLINKING_RATE_MS 500
mbed_official 88:bea4f2daa48c 12
mbed_official 102:6979ad8bc0bc 13
mbed_official 82:abf1b1785bd7 14 int main()
mbed_official 82:abf1b1785bd7 15 {
mbed_official 102:6979ad8bc0bc 16 // Initialise the digital pin LED1 as an output
mbed_official 102:6979ad8bc0bc 17 DigitalOut led(LED1);
mbed_official 82:abf1b1785bd7 18
Jonathan Austin 0:2757d7abb7d9 19 while (true) {
mbed_official 102:6979ad8bc0bc 20 led = !led;
mbed_official 102:6979ad8bc0bc 21 thread_sleep_for(BLINKING_RATE_MS);
Jonathan Austin 0:2757d7abb7d9 22 }
Jonathan Austin 0:2757d7abb7d9 23 }