Hello all,
I am giving VSCode and PlaformIO a try looking for a better coding experience for Arduino. I am having what seems to be some basic difficulty with a custom class.
I have both the .h and the .cpp in the same folder under lib.
My issue is that all of my private variables show as undefined in the cpp file. What is interesting is that if I select one of the undefined variables and press F12, it finds the correct line in the .h file.
Any suggestions on what I am doing wrong?
Thanks
Karl
h file
#ifndef CT_Food_Dispenser_h
#define CT_Food_Dispenser_h
#include <Arduino.h>
class ctFoodDispenser
{
public:
ctFoodDispenser(int bowlSensorPin, int hopperSensorPinMin, int hopperSensorPinMax, int motorEnablePin, int motorStepPin, int motorDirPin);
void dispense(int count);
private:
int _bowlSensorPin;
int _hopperSensorPinMin;
int _hopperSensorPinMax;
int _motorEnablePin;
int _motorStepPin;
int _motorDirPin;
};
#endif
CPP File
#include <Arduino.h>
#include "CT_Food_Dispenser.h"
class ctFoodDispenser
{
ctFoodDispenser(int bowlSensorPin, int hopperSensorPinMin, int hopperSensorPinMax, int motorEnablePin, int motorStepPin, int motorDirPin)
{
_motorEnablePin = motorEnablePin;
_motorStepPin = motorStepPin;
_bowlSensorPin = 1;
};
void dispense(int count){
};
};