Error: Function not declared in the scope
I want to make a timer library. The cpp file I have written is:
#include "avr/interrupt.h"
#include "Arduino.h"
#include "AllTimer.h"
AllTimer::AllTimer()
{}
void AllTimer::dofun(void)
{
TIFR1 |= _BV(OCF1A);
TCCR1B = 0X00;
DigitalWrite(13,!digitalRead(13));
}
void AllTimer::setTimer(void)
{
TCNT1 = 0x0BDC;
TCCR1A = 0x00;
TCCR1B = 0x00;
TCCR1B |= (1<<CS12) && (1<<CS10);
TIMSK1 |= (1<<TOIE1);
sei();
}
ISR (TIMER1_OVF_vect)
{
dofun();
}
And the header file:
#ifndef AllTimer_h
#define AllTimer_h
class AllTimer{
public:
AllTimer();
void setTimer(void);
private:
void dofun(void);
};
#endif
While compiling the file i am getting the following error:
sketch_jan05a.cpp: In function ‘void __vector_13()’:
sketch_jan05a.cpp:34:9: error: ‘dofun’ was not declared in this scope
explorer
- 379
- 2
- 5
- 17
lang-cpp