![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
chad
Dependencies: MCP23017 WattBob_TextLCD mbed-rtos mbed
Diff: tasks.cpp
- Revision:
- 20:aeb7b7044c31
- Parent:
- 19:1fecb6fa14a2
--- a/tasks.cpp Tue Apr 04 13:47:53 2017 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,95 +0,0 @@ -#include "main.h" - -void speedControl(void) -{ - Accel_Reg = (Accel * 100); - Brake_Reg = (Brake * 100); -} - - -void ignition(void) -{ - Ignit_LED = Ignit; -} - -void Speed_avg(void) -{ - Speed_2 = Speed_1; - Speed_1 = Speed_0; - Speed_0 = Speed_In; - - Avg_Speed = ((Speed_2 + Speed_1 + Speed_0)/3); -} - -void Speed_Indi(void) -{ - p = (Avg_Speed/100); - SpeedIndicator = p; -} - -void OverSpeed(void) -{ - if (Avg_Speed >= 70) - O_S_LED = 1; - else - O_S_LED = 0; -} - -void Display(void) -{ - lcd->locate(0,0); - lcd->printf(".2%fmi, .2%fmph", Dist, Avg_Speed); -} - -void Mail_queue(void) -{ - mail_t *mail = mail_box.alloc() - mail->speed = Avg_Speed; - mail->accelerator = Accel_Reg; - mail->brake = Brake_Reg; -} - -void Mail_print(void) -{ - pc.printf("Speed: %f\r",mail->speed); - pc.printf("Accelerator: %f\r",mail->accelerator); - pc.printf("Brake: %f\r",mail->brake); - mail_box.free(mail); -} - -void side_light(void) -{ - SideL_LED = SideL; -} - -void indicator(void) -{ - if (Indi_L == 1 && Indi_R == 1) - { - Indi_L_LED = 1; - Indi_R_LED = 1; - wait(0.25); - Indi_L_LED = 0; - Indi_R_LED = 0; - wait(0.25); - } - else if (Indi_L == 1) - { - Indi_L_LED != Indi_L_LED; - wait(0.5); - } - else if (Indi_R == 1) - { - Indi_R_LED != Indi_R_LED; - wait(0.5); - } -} - -void car_sim(void) -{ - Speed_In = Speed_In + ((Accel_Reg - Brake_Reg)*?); -} - - - -