Hi,
I'm not sure this will work, so if anyone can help...
In my code there's the following function:
void updateBCDOutput(boolean bcdAValue, boolean bcdBValue, boolean bcdCValue, boolean bcdDValue) {
digitalWrite(A0, bcdAValue);
digitalWrite(A1, bcdBValue);
digitalWrite(A2, bcdCValue);
digitalWrite(A3, bcdDValue);
Pins A0, A1, A2 and A3 are previously initialized:
// Pin mode setup for BCD output.
void BCDPinsInitialize() {
pinMode(A0, OUTPUT);
pinMode(A1, OUTPUT);
pinMode(A2, OUTPUT);
pinMode(A3, OUTPUT);
digitalWrite(A0, LOW);
digitalWrite(A1, LOW);
digitalWrite(A2, LOW);
digitalWrite(A3, LOW);
}
I would like to call the updateBCDOutput and pass the pin state. Example:
updateBCDOutput(HIGH, LOW, HIGH, LOW);
I have checked the Arduino documentation and HIGH and LOW and defined as constants:
By defining void updateBCDOutput(boolean bcdAValue, boolean bcdBValue, boolean bcdCValue, boolean bcdDValue) I am afraid that I'm casting HIGH and LOW to boolean values (true and false) and that this will not work on a digitalWrite().
Nevertheless, it should be possible to pass HIGH and LOW as parameters to a function.
What would be the correct way of doing so?
Thank you!