/* PWMSampler - Library for samling a pin for a PWM signal. */ #ifndef PWMSampler_h #define PWMSampler_h #ifndef PinChangeInt_h #define LIBCALL_PINCHANGEINT #include <PinChangeInt.h> #endif #include "Arduino.h"; class PWMSampler { public: PWMSampler(int pin, unsigned long timeout);
private:
.....void doSampleLow(); // interrupt handler for Low going signal void doSampleHigh(); // interrupt handler for High going signal }; #endif
And my Code file looks ike this
#include "Arduino.h"; #include "PWMSampler.h"; #ifndef PinChangeInt_h #define LIBCALL_PINCHANGEINT #include <PinChangeInt.h> #endif /* CONSTRUCTOR */ PWMSampler::PWMSampler(int pin, unsigned long timeout) { unsigned long now = micros(); pinMode(pin, INPUT); ..... PinChangeInt_h::attachInterrupt(pin, &PWMSampler::doSampleLow, FALLING); PinChangeInt_h::attachInterrupt(pin, &PWMSampler::doSampleHigh, RISING); } /* PUBLIC */ .....
/* PRIVATE */ void PWMSampler::doSampleLow() { ..... } void PWMSampler::doSampleHigh() { ..... }
Compiling 'SpindleControl' for 'Arduino Uno'
PWMSampler.cpp:In constructor 'PWMSampler::PWMSampler(int, long unsigned int)'
PWMSampler.cpp:28: error: cannot convert 'void (PWMSampler::*)()' to 'void (*)()' for argument '2' to 'void attachInterrupt(uint8_t, void (*)(), int)'
PWMSampler.cpp:29: error: cannot convert 'void (PWMSampler::*)()' to 'void (*)()' for argument '2' to 'void attachInterrupt(uint8_t, void (*)(), int)'
Error compiling
--
You received this message because you are subscribed to the Google Groups "arduino-pinchangeint-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to arduino-pinchangeint...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.