Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
main.cpp@2:2d14566062e9, 2018-12-06 (annotated)
- Committer:
- marcinch
- Date:
- Thu Dec 06 10:44:46 2018 +0000
- Revision:
- 2:2d14566062e9
- Parent:
- 1:e158e4f407da
- Child:
- 3:d5d12de5808c
Blinking functionality added to all LEDs (refs: LED1, LED2, LED3)
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
marcinch | 0:09421d80c468 | 1 | /* mbed Microcontroller Library |
marcinch | 0:09421d80c468 | 2 | * Copyright (c) 2018 ARM Limited |
marcinch | 0:09421d80c468 | 3 | * SPDX-License-Identifier: Apache-2.0 |
marcinch | 0:09421d80c468 | 4 | */ |
marcinch | 0:09421d80c468 | 5 | |
marcinch | 0:09421d80c468 | 6 | #include "mbed.h" |
marcinch | 1:e158e4f407da | 7 | //#include "stats_report.h" |
marcinch | 0:09421d80c468 | 8 | |
marcinch | 2:2d14566062e9 | 9 | /* |
marcinch | 2:2d14566062e9 | 10 | * Pin names available here: |
marcinch | 2:2d14566062e9 | 11 | * https://os.mbed.com/platforms/LPCXpresso54608/ |
marcinch | 2:2d14566062e9 | 12 | */ |
marcinch | 0:09421d80c468 | 13 | DigitalOut led1(LED1); |
marcinch | 2:2d14566062e9 | 14 | DigitalOut led2(LED2); |
marcinch | 2:2d14566062e9 | 15 | DigitalOut led3(LED_RED); |
marcinch | 2:2d14566062e9 | 16 | |
marcinch | 2:2d14566062e9 | 17 | /* |
marcinch | 2:2d14566062e9 | 18 | * API for DigitalOut class with example available here: |
marcinch | 2:2d14566062e9 | 19 | * https://os.mbed.com/docs/latest/apis/digitalout.html |
marcinch | 2:2d14566062e9 | 20 | */ |
marcinch | 0:09421d80c468 | 21 | |
marcinch | 0:09421d80c468 | 22 | // main() runs in its own thread in the OS |
marcinch | 0:09421d80c468 | 23 | int main() |
marcinch | 0:09421d80c468 | 24 | { |
marcinch | 1:e158e4f407da | 25 | //SystemReport sys_state(500 /* Loop delay time in ms */); |
marcinch | 2:2d14566062e9 | 26 | |
marcinch | 2:2d14566062e9 | 27 | //Setting all pins to low (in this case LEDs will be ON) and wait 2 seconds before while loop starts |
marcinch | 2:2d14566062e9 | 28 | led1 = led2 = led3 = 0; |
marcinch | 2:2d14566062e9 | 29 | wait(2.0f); |
marcinch | 2:2d14566062e9 | 30 | |
marcinch | 0:09421d80c468 | 31 | while (true) { |
marcinch | 0:09421d80c468 | 32 | // Blink LED and wait 0.5 seconds |
marcinch | 0:09421d80c468 | 33 | led1 = !led1; |
marcinch | 0:09421d80c468 | 34 | wait(0.5f); |
marcinch | 2:2d14566062e9 | 35 | led2 = !led2; |
marcinch | 2:2d14566062e9 | 36 | wait(0.5f); |
marcinch | 2:2d14566062e9 | 37 | led3 = !led3; |
marcinch | 2:2d14566062e9 | 38 | wait(0.5f); |
marcinch | 0:09421d80c468 | 39 | |
marcinch | 0:09421d80c468 | 40 | // Following the main thread wait, report on the current system status |
marcinch | 1:e158e4f407da | 41 | //sys_state.report_state(); |
marcinch | 2:2d14566062e9 | 42 | }//end while |
marcinch | 2:2d14566062e9 | 43 | } |