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
- Committer:
- tomotsugu
- Date:
- 2020-07-09
- Revision:
- 0:c8547914b033
File content as of revision 0:c8547914b033:
#include "mbed.h" #include "rtos.h" DigitalOut led1(p17); DigitalOut led2(p18); DigitalOut led3(p19); DigitalOut led4(p20); DigitalOut led5(p27); DigitalOut led6(p28); DigitalOut led7(p29); DigitalOut led8(p30); void led1_thread(void const *arg){ while(1){ Thread::signal_wait(0x1); led1 = !led1; } } void led2_thread(void const *arg){ while(1){ Thread::signal_wait(0x1); led2 = !led2; } } void led3_thread(void const *arg){ while(1){ Thread::signal_wait(0x1); led3 = !led3; } } void led4_thread(void const *arg){ while(1){ Thread::signal_wait(0x1); led4 = !led4; } } void led5_thread(void const *arg){ while(1){ Thread::signal_wait(0x2); led5 = !led5; } } void led6_thread(void const *arg){ while(1){ Thread::signal_wait(0x2); led6 = !led6; } } void led7_thread(void const *arg){ while(1){ Thread::signal_wait(0x2); led7 = !led7; } } void led8_thread(void const *arg){ while(1){ Thread::signal_wait(0x2); led8 = !led8; } } int main(){ Thread thread1(led1_thread); Thread thread2(led2_thread); Thread thread3(led3_thread); Thread thread4(led4_thread); Thread thread5(led5_thread); Thread thread6(led6_thread); Thread thread7(led7_thread); Thread thread8(led8_thread); while(1){ thread1.signal_set(0x1); ThisThread::sleep_for(10); thread2.signal_set(0x1); ThisThread::sleep_for(10); thread3.signal_set(0x1); ThisThread::sleep_for(10); thread4.signal_set(0x1); ThisThread::sleep_for(10); thread5.signal_set(0x2); ThisThread::sleep_for(10); thread6.signal_set(0x2); ThisThread::sleep_for(10); thread7.signal_set(0x2); ThisThread::sleep_for(10); thread8.signal_set(0x2); ThisThread::sleep_for(10); } }