Skip to main content
Arduino

Return to Question

deleted 29 characters in body
Source Link
jfpoilpret
  • 9.2k
  • 7
  • 38
  • 54

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;
 DigitalWritedigitalWrite(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

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

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
Improved formatting
Source Link
Peter Bloomfield
  • 11k
  • 9
  • 48
  • 87

iI want to make a timer library. The cpp file iI 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(); }

#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

#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

sketch_jan05a.cpp: In function ‘void __vector_13()’:
sketch_jan05a.cpp:34:9: error: ‘dofun’ was not declared in this 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

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
Source Link
explorer
  • 379
  • 2
  • 5
  • 17

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

lang-cpp

AltStyle によって変換されたページ (->オリジナル) /