I have an instance of an object Gate, called the_Gate. The code below is exposing a variable that is private inside the object, the accessor function for that variable is getGateOpenSwitchState. The code below compiles fine. The next set does not. Any ideas?
the_Gate.init();
int foo = the_Gate.getGateOpenSwitchState();
Particle.variable("readOpen", &(foo), INT);
the_Gate.init();
Particle.variable("readOpen", &(the_Gate.getGateOpenSwitchState()), INT);
The compiler returns ‘value required as unary & operand’
.......
.....
private:
void gate_running_timeout();
gate_state current_GateState;
Timer gate_timer;
int openSwitch = OPENSWITCH;
int closedSwitch = CLOSESWITCH;
int openSwitchValue;
int closedSwitchValue;
.....
.....
int Gate::getGateOpenSwitchState(){
openSwitchValue = gpio.digitalRead(openSwitch);
return(openSwitchValue);
}
.....
.....
matt