smit-happens / YCP_EVOS

Development for the 2018 YCP Formula Electric Vehicle
MIT License
9 stars 1 forks source link

Brake light flickers when brake is at zero #165

Closed smit-happens closed 6 years ago

smit-happens commented 6 years ago

End goal

stop the flickering

Relevant Info/Links

most likely due to no averaging function performed on the brake pedal

Your Code

void PedalController::CheckBrakeLight(void)
{
    //checks if the brake pedal has been pressed far enough to turn on the brake light
    if(getPercentageBrake() > BRAKE_LIGHT_PERCENT)
        LightController::getInstance()->turnOn(LightController::LIGHT_BRAKE);
    else
        LightController::getInstance()->turnOff(LightController::LIGHT_BRAKE);
}