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.
Dependencies: mbed
main.cpp@0:7c0bfc9d2e16, 2017-12-23 (annotated)
- Committer:
- osmith2
- Date:
- Sat Dec 23 00:50:58 2017 +0000
- Revision:
- 0:7c0bfc9d2e16
- Child:
- 1:24717a795dc0
Created this to test out concatenation ideas rather than mess with working code. This, as far as I am aware, solves our problem, and the whole concatenate thing was over-complicating things???
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| osmith2 | 0:7c0bfc9d2e16 | 1 | #include "mbed.h" |
| osmith2 | 0:7c0bfc9d2e16 | 2 | |
| osmith2 | 0:7c0bfc9d2e16 | 3 | |
| osmith2 | 0:7c0bfc9d2e16 | 4 | |
| osmith2 | 0:7c0bfc9d2e16 | 5 | |
| osmith2 | 0:7c0bfc9d2e16 | 6 | |
| osmith2 | 0:7c0bfc9d2e16 | 7 | Serial pc(USBTX, USBRX); |
| osmith2 | 0:7c0bfc9d2e16 | 8 | |
| osmith2 | 0:7c0bfc9d2e16 | 9 | |
| osmith2 | 0:7c0bfc9d2e16 | 10 | |
| osmith2 | 0:7c0bfc9d2e16 | 11 | int year = 2017; |
| osmith2 | 0:7c0bfc9d2e16 | 12 | char month = 12; |
| osmith2 | 0:7c0bfc9d2e16 | 13 | char day = 25; |
| osmith2 | 0:7c0bfc9d2e16 | 14 | char hour = 23; |
| osmith2 | 0:7c0bfc9d2e16 | 15 | char minute = 28; |
| osmith2 | 0:7c0bfc9d2e16 | 16 | |
| osmith2 | 0:7c0bfc9d2e16 | 17 | DigitalOut myled(LED1); |
| osmith2 | 0:7c0bfc9d2e16 | 18 | |
| osmith2 | 0:7c0bfc9d2e16 | 19 | int main() { |
| osmith2 | 0:7c0bfc9d2e16 | 20 | while(1) { |
| osmith2 | 0:7c0bfc9d2e16 | 21 | myled = 1; // LED is ON |
| osmith2 | 0:7c0bfc9d2e16 | 22 | wait(0.2); // 200 ms |
| osmith2 | 0:7c0bfc9d2e16 | 23 | myled = 0; // LED is OFF |
| osmith2 | 0:7c0bfc9d2e16 | 24 | wait(1.0); // 1 sec |
| osmith2 | 0:7c0bfc9d2e16 | 25 | |
| osmith2 | 0:7c0bfc9d2e16 | 26 | //date |
| osmith2 | 0:7c0bfc9d2e16 | 27 | pc.printf("Year: %d\n", year); |
| osmith2 | 0:7c0bfc9d2e16 | 28 | pc.printf("Month: %d\n", month); |
| osmith2 | 0:7c0bfc9d2e16 | 29 | pc.printf("Day: %d\n", day); |
| osmith2 | 0:7c0bfc9d2e16 | 30 | //time |
| osmith2 | 0:7c0bfc9d2e16 | 31 | pc.printf("Hour: %d\n", hour); |
| osmith2 | 0:7c0bfc9d2e16 | 32 | pc.printf("Minute: %d\n", minute); |
| osmith2 | 0:7c0bfc9d2e16 | 33 | |
| osmith2 | 0:7c0bfc9d2e16 | 34 | |
| osmith2 | 0:7c0bfc9d2e16 | 35 | // SOOooooo, am I retarded or can we not just do this? |
| osmith2 | 0:7c0bfc9d2e16 | 36 | pc.printf("Date and time: %d.%d.%d.%d.%d \n", year, month, day, hour, minute); |
| osmith2 | 0:7c0bfc9d2e16 | 37 | pc.printf("Merry christmas!"); |
| osmith2 | 0:7c0bfc9d2e16 | 38 | } |
| osmith2 | 0:7c0bfc9d2e16 | 39 | } |