APS de Sistemas Operacionais / Controle 2 FINAL
Dependencies: EthernetInterface HCSR04 PID Servo mbed-rtos mbed
Fork of aps_so_c2_old by
main.cpp@2:f3ba67384801, 2017-11-18 (annotated)
- Committer:
- feupos
- Date:
- Sat Nov 18 17:19:53 2017 +0000
- Revision:
- 2:f3ba67384801
- Parent:
- 1:c07ed2436cd8
- Child:
- 3:3d094a31a283
fixed;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
feupos | 0:8d53c4c11953 | 1 | #include "mbed.h" |
feupos | 0:8d53c4c11953 | 2 | #include "rtos.h" |
feupos | 2:f3ba67384801 | 3 | #include "EthernetInterface.h" |
feupos | 2:f3ba67384801 | 4 | |
feupos | 2:f3ba67384801 | 5 | enum status{ IDLE, ADJUSTING, STABLE }; |
feupos | 0:8d53c4c11953 | 6 | |
feupos | 2:f3ba67384801 | 7 | status statusFlag; |
feupos | 2:f3ba67384801 | 8 | |
feupos | 2:f3ba67384801 | 9 | DigitalOut ledR(LED1); |
feupos | 2:f3ba67384801 | 10 | DigitalOut ledG(LED2); |
feupos | 2:f3ba67384801 | 11 | DigitalOut ledB(LED3); |
feupos | 2:f3ba67384801 | 12 | |
feupos | 0:8d53c4c11953 | 13 | InterruptIn sw2(SW2); |
feupos | 2:f3ba67384801 | 14 | InterruptIn sw3(SW3); |
feupos | 0:8d53c4c11953 | 15 | |
feupos | 0:8d53c4c11953 | 16 | void sw2_press(void) |
feupos | 2:f3ba67384801 | 17 | { |
feupos | 0:8d53c4c11953 | 18 | } |
feupos | 0:8d53c4c11953 | 19 | |
feupos | 0:8d53c4c11953 | 20 | void led_thread(void const *argument) |
feupos | 0:8d53c4c11953 | 21 | { |
feupos | 0:8d53c4c11953 | 22 | while (true) { |
feupos | 2:f3ba67384801 | 23 | switch(statusFlag) |
feupos | 2:f3ba67384801 | 24 | { |
feupos | 2:f3ba67384801 | 25 | default: |
feupos | 2:f3ba67384801 | 26 | ledR = !ledR; |
feupos | 2:f3ba67384801 | 27 | Thread::wait(1000); |
feupos | 2:f3ba67384801 | 28 | break; |
feupos | 2:f3ba67384801 | 29 | } |
feupos | 0:8d53c4c11953 | 30 | } |
feupos | 0:8d53c4c11953 | 31 | } |
feupos | 0:8d53c4c11953 | 32 | |
feupos | 0:8d53c4c11953 | 33 | void button_thread(void const *argument) |
feupos | 0:8d53c4c11953 | 34 | { |
feupos | 2:f3ba67384801 | 35 | |
feupos | 0:8d53c4c11953 | 36 | } |
feupos | 0:8d53c4c11953 | 37 | |
feupos | 0:8d53c4c11953 | 38 | int main() |
feupos | 0:8d53c4c11953 | 39 | { |
feupos | 2:f3ba67384801 | 40 | printf("APS Sistemas Operacionais / Controle 2\n"); |
feupos | 2:f3ba67384801 | 41 | printf("Alunos: Felipe, Juliana, Rafael\n"); |
feupos | 0:8d53c4c11953 | 42 | |
feupos | 0:8d53c4c11953 | 43 | } |