Skip to main content
new ideas...
Source Link
TheDoctor
  • 3.5k
  • 1
  • 22
  • 39

I think the problem is very simple. In TIMER2_COMPA_vectyour setup function, you haveneed to instantiate your timer, like this code:

ISRstatic Timer timer;

void setup(TIMER2_COMPA_vect)
{
    milliseconds++;timer = new Timer();                       <<<--- here
    callEveryMillisecondpinMode(millisecond13, OUTPUT);
}

void loop()
{
}

You have the variable milliseconds, which you increment, and then you call the callEveryMillisecond function and pass the variable millisecond (without the s)

I think the problem is very simple. In TIMER2_COMPA_vect, you have this code:

ISR(TIMER2_COMPA_vect)
{
    milliseconds++;
    callEveryMillisecond(millisecond);
}

You have the variable milliseconds, which you increment, and then you call the callEveryMillisecond function and pass the variable millisecond (without the s)

In your setup function, you need to instantiate your timer, like this:

static Timer timer;

void setup()
{
    timer = new Timer();                       <<<--- here
    pinMode(13, OUTPUT);
}

void loop()
{
}
Source Link
TheDoctor
  • 3.5k
  • 1
  • 22
  • 39

I think the problem is very simple. In TIMER2_COMPA_vect, you have this code:

ISR(TIMER2_COMPA_vect)
{
    milliseconds++;
    callEveryMillisecond(millisecond);
}

You have the variable milliseconds, which you increment, and then you call the callEveryMillisecond function and pass the variable millisecond (without the s)