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@1:5a458b26e64d, 2019-03-09 (annotated)
- Committer:
- lamoreauxaj
- Date:
- Sat Mar 09 18:20:06 2019 +0000
- Revision:
- 1:5a458b26e64d
- Parent:
- 0:8a7153ecd2bc
- Child:
- 2:9bd28448e604
added tfc library and setup update function;
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| lamoreauxaj | 0:8a7153ecd2bc | 1 | /* mbed Microcontroller Library |
| lamoreauxaj | 0:8a7153ecd2bc | 2 | * Copyright (c) 2018 ARM Limited |
| lamoreauxaj | 0:8a7153ecd2bc | 3 | * SPDX-License-Identifier: Apache-2.0 |
| lamoreauxaj | 0:8a7153ecd2bc | 4 | */ |
| lamoreauxaj | 0:8a7153ecd2bc | 5 | |
| lamoreauxaj | 0:8a7153ecd2bc | 6 | #include "mbed.h" |
| lamoreauxaj | 1:5a458b26e64d | 7 | #include "TFC.h" |
| lamoreauxaj | 0:8a7153ecd2bc | 8 | |
| lamoreauxaj | 0:8a7153ecd2bc | 9 | DigitalOut led1(LED1); |
| lamoreauxaj | 1:5a458b26e64d | 10 | DigitalIn camera1(PTD5), camera2(PTD6); |
| lamoreauxaj | 1:5a458b26e64d | 11 | Serial pc(USBTX, USBRX); |
| lamoreauxaj | 0:8a7153ecd2bc | 12 | |
| lamoreauxaj | 0:8a7153ecd2bc | 13 | |
| lamoreauxaj | 1:5a458b26e64d | 14 | void update(float delta, float currTime) { |
| lamoreauxaj | 1:5a458b26e64d | 15 | // pc.printf("Update: %.2f %.2f\r\n", delta, currTime); |
| lamoreauxaj | 1:5a458b26e64d | 16 | pc.printf("Camera1: %d; Camera2 %d\r\n", camera1.read(), camera2.read()); |
| lamoreauxaj | 1:5a458b26e64d | 17 | } |
| lamoreauxaj | 0:8a7153ecd2bc | 18 | |
| lamoreauxaj | 1:5a458b26e64d | 19 | int main() { |
| lamoreauxaj | 1:5a458b26e64d | 20 | int startClock = 0; |
| lamoreauxaj | 1:5a458b26e64d | 21 | float lastTime = 0; |
| lamoreauxaj | 1:5a458b26e64d | 22 | |
| lamoreauxaj | 0:8a7153ecd2bc | 23 | while (true) { |
| lamoreauxaj | 1:5a458b26e64d | 24 | |
| lamoreauxaj | 1:5a458b26e64d | 25 | float currTime = float(clock() - startClock) / CLOCKS_PER_SEC; |
| lamoreauxaj | 1:5a458b26e64d | 26 | update(currTime - lastTime, currTime); |
| lamoreauxaj | 1:5a458b26e64d | 27 | lastTime = currTime; |
| lamoreauxaj | 1:5a458b26e64d | 28 | |
| lamoreauxaj | 0:8a7153ecd2bc | 29 | } |
| lamoreauxaj | 0:8a7153ecd2bc | 30 | } |
