uint8_t flex_flag, motor_started; //Flags set after events 

    //Initialize flags  
    flex_flag = 0;  
    motor_started = 0;