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: EthernetInterface SDFileSystem mbed-rtos mbed
main.cpp
00001 #include "mbed.h" 00002 #include "rtos.h" 00003 00004 DigitalOut led1(LED1); 00005 DigitalOut led2(LED2); 00006 DigitalOut led3(LED3); 00007 DigitalOut led4(LED4); 00008 00009 Serial pc(PC_6,PC_7); 00010 uint16_t ledvalue=0; 00011 uint16_t ledvalue2=0; 00012 Ticker tick; 00013 void setLed(uint8_t val) 00014 { 00015 // led1=val % 2; 00016 00017 led2=(val /2 ) % 2; 00018 00019 led3=(val /4 ) % 2; 00020 00021 led4=(val /5 ) % 2; 00022 } 00023 00024 void printstr(void const *args) 00025 { 00026 while (true) { 00027 pc.printf("Hello World,Now value is %d.\n",ledvalue); 00028 // pc.printf("Hello World,Now value is %d.\n",*(uint8_t *)args); 00029 Thread::wait(1000); 00030 } 00031 } 00032 00033 void led(void const *args) 00034 { 00035 while (true) { 00036 led1=!led1; 00037 Thread::wait(100); 00038 } 00039 } 00040 00041 int main() 00042 { 00043 //Thread thread(printstr); 00044 Thread thread(printstr,&ledvalue); 00045 Thread thread2(led,&ledvalue2); 00046 while (1) 00047 { 00048 setLed(++ledvalue); 00049 Thread::wait(100); 00050 } 00051 }
Generated on Tue Jul 12 2022 23:42:25 by
1.7.2