hello,
have this piece of code and wonder why void funtion is causing the problem:
Code:
void TurnLed( int flag){
if(flag){
digitalWrite(PinLed, HIGH);
} else {
digitalWrite(PinLed, LOW);
}
}
void loop() {
Serial.println(digitalRead(PinBtn));
(state == digitalRead(PinBtn)) ? : (state=digitalRead(PinBtn) , TurnLed(state) ) ;
delay(300); // wait for a second
}
Code:
/home/az/work/Arduino/Sketches/Examples/Push_Led/Push_Led.ino:35:82: error: third operand to the conditional operator is of type 'void', but the second operand is neither a throw-expression nor of type 'void'
(state == digitalRead(PinBtn)) ? : (state=digitalRead(PinBtn) , TurnLed(state) ) ;
^
[Stino - Exit with error code 1.]