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.
Revision 1:ef8b9b9fe97d, committed 2017-12-19
- Comitter:
- makia
- Date:
- Tue Dec 19 07:53:14 2017 +0000
- Parent:
- 0:264924f590d2
- Commit message:
- add thread
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Tue Dec 19 07:03:16 2017 +0000 +++ b/main.cpp Tue Dec 19 07:53:14 2017 +0000 @@ -4,6 +4,7 @@ Serial pc(USBTX, USBRX); //TX, RX DigitalOut led(LED1); + double delay = 0.5; // 500 ms int tamp = 0; //เอามาดูค่าที่ใช้ทดลองกดปุ่ม @@ -13,10 +14,12 @@ tamp = tamp + 1 ; } -void released() -{ - delay = 0.5; // 500 ms - pc.printf("tamp stable = %d " , tamp); +void led2_thread() { + while (true) { + led2 = !led2; + pc.printf("test thread\n"); + wait(60); + } } int main() @@ -24,7 +27,8 @@ // Assign functions to button button.fall(&pressed); button.rise(&released); - + thread.start(led2_thread); + while (1) { led = !led; pc.printf("%d" , tamp);