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:
- davidahuertas
- Date:
- 2022-05-06
- Revision:
- 0:b04aae5b80fd
File content as of revision 0:b04aae5b80fd:
#include "mbed.h"
#include "rtos.h"
DigitalOut led1(LED6);
DigitalOut led2(LED1);
Mutex mutex;
uint32_t cont =0;
bool done[2] = {0,0};
Thread t1;
Thread t2;
void thread1( const int *i){
int conth;
int conth2 =0;
while(conth2<100){
mutex.lock();
conth = cont;
conth2++;
conth++;
Thread::wait(10);
cont = conth;
printf(" %d\n\r ",cont);
mutex.unlock();
}
done[(int)i] =1;
}
int main(){
t1.start(callback(thread1, (int*) 1));
t2.start(callback(thread1, (int*) 2));
while(1){
Thread::wait(1);
if(done[0] && done[1]){
if(cont == 200){
led1=1;
}
else{
led2 = 1;
}
}
}
}