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:cb470cb42e12, 2020-11-13 (annotated)
- Committer:
- hakusan270
- Date:
- Fri Nov 13 04:02:01 2020 +0000
- Revision:
- 0:cb470cb42e12
study1
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| hakusan270 | 0:cb470cb42e12 | 1 | #include "mbed.h" |
| hakusan270 | 0:cb470cb42e12 | 2 | #include <time.h> |
| hakusan270 | 0:cb470cb42e12 | 3 | //勉強会 |
| hakusan270 | 0:cb470cb42e12 | 4 | DigitalOut myled(LED1); |
| hakusan270 | 0:cb470cb42e12 | 5 | |
| hakusan270 | 0:cb470cb42e12 | 6 | int main() { |
| hakusan270 | 0:cb470cb42e12 | 7 | |
| hakusan270 | 0:cb470cb42e12 | 8 | printf("\r\nStruct\r\n"); |
| hakusan270 | 0:cb470cb42e12 | 9 | time_t mk; |
| hakusan270 | 0:cb470cb42e12 | 10 | struct tm tm_mk; |
| hakusan270 | 0:cb470cb42e12 | 11 | struct tm *tm_lt; |
| hakusan270 | 0:cb470cb42e12 | 12 | // 時間定義 2020/11/12 10:20:30 |
| hakusan270 | 0:cb470cb42e12 | 13 | tm_mk.tm_year = 2020 - 1900; |
| hakusan270 | 0:cb470cb42e12 | 14 | tm_mk.tm_mon = 11 - 1; |
| hakusan270 | 0:cb470cb42e12 | 15 | tm_mk.tm_mday = 12; |
| hakusan270 | 0:cb470cb42e12 | 16 | tm_mk.tm_hour = 10; |
| hakusan270 | 0:cb470cb42e12 | 17 | tm_mk.tm_min = 20; |
| hakusan270 | 0:cb470cb42e12 | 18 | tm_mk.tm_sec = 30; |
| hakusan270 | 0:cb470cb42e12 | 19 | mk = mktime(&tm_mk); |
| hakusan270 | 0:cb470cb42e12 | 20 | printf("mktime:%d\r\n", mk); |
| hakusan270 | 0:cb470cb42e12 | 21 | set_time(mk); |
| hakusan270 | 0:cb470cb42e12 | 22 | tm_lt = localtime(&mk); |
| hakusan270 | 0:cb470cb42e12 | 23 | printf("日付 - %04d/%02d/%02d\r\n", tm_lt->tm_year + 1900, tm_lt->tm_mon + 1, tm_lt->tm_mday); |
| hakusan270 | 0:cb470cb42e12 | 24 | printf("時刻 - %02d:%02d:%02d\r\n", tm_lt->tm_hour, tm_lt->tm_min, tm_lt->tm_sec); |
| hakusan270 | 0:cb470cb42e12 | 25 | |
| hakusan270 | 0:cb470cb42e12 | 26 | // mk=time(NULL); |
| hakusan270 | 0:cb470cb42e12 | 27 | |
| hakusan270 | 0:cb470cb42e12 | 28 | while(1) { |
| hakusan270 | 0:cb470cb42e12 | 29 | wait(1); |
| hakusan270 | 0:cb470cb42e12 | 30 | myled = !myled; |
| hakusan270 | 0:cb470cb42e12 | 31 | //時刻表示しよう |
| hakusan270 | 0:cb470cb42e12 | 32 | } |
| hakusan270 | 0:cb470cb42e12 | 33 | } |