Hello,
I'm trying to use the IntervalTimer library with the adc to get periodic readings. I want to create a new IntervalTimer object with:
That line is inside a function in the ADC library (ADC.cpp). timerPin is a struct defined in the ADC.h header file:
The linker gives an error:
In a simple sketch (Blinker) I can do:
So I have no idea what the problem is. I'm not an expert C++ programmer, so I don't know what to do. Can you help me?
I'm trying to use the IntervalTimer library with the adc to get periodic readings. I want to create a new IntervalTimer object with:
Code:
timerPin[i].timer = new IntervalTimer();
That line is inside a function in the ADC library (ADC.cpp). timerPin is a struct defined in the ADC.h header file:
Code:
typedef struct{
int pinNumber = -1; // the timer is deactivated
IntervalTimer *timer; // timer
RingBuffer *buffer; // circular buffer to store analog values
} IntervalTimerPin;
IntervalTimerPin timerPin[MAX_ANALOG_TIMERS];
The linker gives an error:
Arduino: 1.0.5 (Windows 7), Board: "Teensy 3.0"
ADC\ADC.cpp.o: In function `ADC::startAnalogTimer(unsigned char, unsigned int)':
C:\Users\User\Arduino\libraries\ADC/ADC.cpp:508: undefined reference to `operator new(unsigned int)'
collect2.exe: error: ld returned 1 exit statuss
In a simple sketch (Blinker) I can do:
Code:
int *p;
p = new int(3);
So I have no idea what the problem is. I'm not an expert C++ programmer, so I don't know what to do. Can you help me?