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.
Diff: main.cpp
- Revision:
- 4:2eceeb929edd
- Parent:
- 3:81621bb4f009
- Child:
- 5:ffba8ba016a7
--- a/main.cpp Wed Jul 04 00:01:47 2018 +0000 +++ b/main.cpp Thu Jul 05 00:19:23 2018 +0000 @@ -1,6 +1,9 @@ #include "mbed.h" #include "rtos.h" + //Fazer escalonador com prioridade, para os botões, piscar led em azul com frequencia diferente com as maiores prioridades + //sensor piscar em vermelho com a prioridade maior + //Interruptions InterruptIn btn1(D7); InterruptIn btn2(D6); @@ -12,10 +15,26 @@ //Outs DigitalOut buzzer(D2); DigitalOut led(LED_BLUE); +DigitalOut ground(D0); //Buttons Threads Thread threadb1, threadb2, threadb3, threadb4; +//Scheduler Thread +Thread scdT; +//Scheduler +int scd[4]; + +//Buttons +int b1 = 0, b2 = 0, b3 = 0, b4 = 0; + +//Scheduler thread +void scdThread() { + + + + } + //Button function void button_pressed() { buzzer = !buzzer; // toggle the LED @@ -25,30 +44,38 @@ //Buttons threads void button1_thread() { btn1.fall(&button_pressed); // whenever the button falls, execute button_pressed function - while(1) {} + b1 = 1; + //while(1) {} } void button2_thread() { btn2.fall(&button_pressed); // whenever the button falls, execute button_pressed function - while(1) {} + b2 = 1; + //while(1) {} } void button3_thread() { btn3.fall(&button_pressed); // whenever the button falls, execute button_pressed function - while(1) {} + b3 = 1; + //while(1) {} } void button4_thread() { btn4.fall(&button_pressed); // whenever the button falls, execute button_pressed function - while(1) {} + b4 = 1; + //while(1) {} } + int main(int, char**) { + ground = 0; led = !led; threadb1.start(button1_thread); threadb2.start(button2_thread); threadb3.start(button3_thread); threadb4.start(button4_thread); + scdT.start(scdThread); + while (1) {} } \ No newline at end of file