Quadcopter software. Flying - Contact me for more details or a copy of the PC ground station code
Dependencies: ConfigFile PID PPM MODSERIAL mbed-rtos mbed MaxbotixDriver TinyGPS filter
statusLights.h@9:7b194f83e567, 2015-02-22 (annotated)
- Committer:
- joe4465
- Date:
- Sun Feb 22 20:10:12 2015 +0000
- Revision:
- 9:7b194f83e567
- Parent:
- 6:4c207e7b1203
Added external magnetometer
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
joe4465 | 0:0010a5abcc31 | 1 | #include "mbed.h" |
joe4465 | 0:0010a5abcc31 | 2 | #include "rtos.h" |
joe4465 | 0:0010a5abcc31 | 3 | #include "hardware.h" |
joe4465 | 0:0010a5abcc31 | 4 | |
joe4465 | 0:0010a5abcc31 | 5 | // The status thread indicates the current system status to the user |
joe4465 | 0:0010a5abcc31 | 6 | void StatusThread(void const *args) |
joe4465 | 0:0010a5abcc31 | 7 | { |
joe4465 | 6:4c207e7b1203 | 8 | printf("Status lights thread started\r\n"); |
joe4465 | 3:82665e39f1ea | 9 | |
joe4465 | 0:0010a5abcc31 | 10 | int ledState = 0; |
joe4465 | 0:0010a5abcc31 | 11 | while (true) |
joe4465 | 0:0010a5abcc31 | 12 | { |
joe4465 | 0:0010a5abcc31 | 13 | ledState++; |
joe4465 | 6:4c207e7b1203 | 14 | if (ledState > 5) { ledState = 0; } |
joe4465 | 0:0010a5abcc31 | 15 | |
joe4465 | 0:0010a5abcc31 | 16 | _led1 = (ledState == 0); |
joe4465 | 0:0010a5abcc31 | 17 | _led2 = (ledState == 1 || ledState == 5); |
joe4465 | 0:0010a5abcc31 | 18 | _led3 = (ledState == 2 || ledState == 4); |
joe4465 | 0:0010a5abcc31 | 19 | _led4 = (ledState == 3); |
joe4465 | 6:4c207e7b1203 | 20 | |
joe4465 | 6:4c207e7b1203 | 21 | Thread::wait(100); |
joe4465 | 0:0010a5abcc31 | 22 | } |
joe4465 | 6:4c207e7b1203 | 23 | } |