I have a VB.net background and I am experimenting with an Arduino Mega 2560 as digital pins to try testing an external relay board. I am having trouble with my C code. There must be something stupid im doing.
I am calling the function ReadAllDigitalInputPins() to get back a long as a bit mask, one bit representing the digital input state of each pin.
The compiler is whinging as follows:
warning: invalid conversion from 'long int (*)()' to 'long int' [-fpermissive]
long result = ReadAllDigitalInputPins;
^~~~~~~~~~~~~~~~~~~~~~~
I read some other references to this error but they dont seem to be relevant. I am not using pointers etc. Any thoughts as to what I am doing wrong? Thanks for any advice.
void ActivateEnableRelayAndCheckPins() {
digitalWrite(EnableRelay, HIGH); //Write a hi to the pin, which switches the ULN2003 low to energize the relay
delay(settlingTime); //Wait X ms for pins to settle after relays close etc.
long result = ReadAllDigitalInputPins;
}
long ReadAllDigitalInputPins() {
long allPortBits = 0;
byte inputPins[] = {CH1TermNO, CH1TermNC, CH2TermNO, CH2TermNC};
for (byte i = 0; i <= sizeof(inputPins) - 1; i++) {
int value = digitalRead(inputPins[i]);
allPortBits = allPortBits << 1; //shift existing bits over one
if (value == HIGH) {
bitWrite(allPortBits, 0, 1);
}else {
bitWrite(allPortBits, 0, 0);
}
}
return allPortBits;
}