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
00001 // たぶん一番簡単な時間管理プログラム - OS5 00002 // 2019.10.17 ... Y.Kuroda 00003 #include "mbed.h" 00004 Thread thread; 00005 DigitalOut p1(LED1); 00006 #define CYC_FLAG 1 00007 00008 void my_thread() // スレッドにする関数.正確な時間間隔で起こされる 00009 { 00010 while (true) { 00011 ThisThread::flags_wait_all(CYC_FLAG); // 起こされるまで寝ている 00012 // 00013 p1 = !p1; // ユーザコードはここに書く 00014 // 00015 } 00016 } 00017 00018 int main (void) { // mainスレッド 00019 thread.start(callback(my_thread)); // 関数をスレッドとして起動する 00020 00021 while (true) { // スレッドの一つとして走る 00022 wait(0.01); // 待つことしかしてないのでかなり正確 00023 thread.flags_set(CYC_FLAG); // 寝ているスレッドを起こす.この処理は一瞬 00024 } 00025 } 00026
Generated on Sun Jul 17 2022 12:15:20 by
1.7.2