federico.bozzini@arm.com
/
blinky-public
Blinky is cool isn't it?
main.cpp@2:0388a1daa4b0, 18 months ago (annotated)
- Committer:
- federicobozzini
- Date:
- Tue Nov 01 11:36:10 2022 +0000
- Revision:
- 2:0388a1daa4b0
- Parent:
- 0:40618b777147
hgignore
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
federicobozzini | 0:40618b777147 | 1 | /* mbed Microcontroller Library |
federicobozzini | 0:40618b777147 | 2 | * Copyright (c) 2019 ARM Limited |
federicobozzini | 0:40618b777147 | 3 | * SPDX-License-Identifier: Apache-2.0 |
federicobozzini | 0:40618b777147 | 4 | */ |
federicobozzini | 0:40618b777147 | 5 | |
federicobozzini | 0:40618b777147 | 6 | #include "mbed.h" |
federicobozzini | 0:40618b777147 | 7 | #include "platform/mbed_thread.h" |
federicobozzini | 0:40618b777147 | 8 | |
federicobozzini | 0:40618b777147 | 9 | |
federicobozzini | 0:40618b777147 | 10 | // Blinking rate in milliseconds |
federicobozzini | 0:40618b777147 | 11 | #define BLINKING_RATE_MS 500 |
federicobozzini | 0:40618b777147 | 12 | |
federicobozzini | 0:40618b777147 | 13 | |
federicobozzini | 0:40618b777147 | 14 | int main() |
federicobozzini | 0:40618b777147 | 15 | { |
federicobozzini | 0:40618b777147 | 16 | // Initialise the digital pin LED1 as an output |
federicobozzini | 0:40618b777147 | 17 | DigitalOut led(LED1); |
federicobozzini | 0:40618b777147 | 18 | |
federicobozzini | 0:40618b777147 | 19 | while (true) { |
federicobozzini | 0:40618b777147 | 20 | led = !led; |
federicobozzini | 0:40618b777147 | 21 | thread_sleep_for(BLINKING_RATE_MS); |
federicobozzini | 0:40618b777147 | 22 | } |
federicobozzini | 0:40618b777147 | 23 | } |