Someone-s-out-there / ProjectCarHAN

0 stars 0 forks source link

[FEAT] Millis library #62

Closed JACKAR710 closed 9 months ago

JACKAR710 commented 11 months ago

Millis library die het aantal milliseconden aan runtime returned

Someone-s-out-there commented 10 months ago
void f(){
    TCCR0A      =       (1<<WGM01);
    OCR0A       =       0xC8;
    TIMSK0 |= (1 << OCIE0A);
    TCCR0B |= (1 << CS02);

}

ISR (TIMER0_COMPA_vect) {           //TIMER 1 SECOND
    timer_count++;
    if(timer_count==156) { //DO SOMETHING EVERY SECOND
        lamp_timeout++;
        motor_timeout++;
        pir_timer++;
        led_timeout++;
        if(current_error==1){

        }

        timer_count=0;
    }   
}

dir kan evt gebruikt worden als de juiste timer geselectteerd word en de juiste prescalar