so im working on road cross supporter machiene that helps elderly people pass the road.
and this error keeps coming up in the code and i dont know why.
i took the boolean that gives true or false based on which sidewalk was pressed
here is the code: (divided to side walk a and b)
int buttA = 8; // the button that will be on side a of the road
int buttB = 2; // the button that will be on side b of the road
int buttSideA = 3; // the button that will fixiate a position that will be on side a on the surface
int buttSideB = 4; // the button that will fixiate a position that will be on side b on the surface
int lowButt = 5; // the button that will fixiate a lowered position of the stand
int supportStandButt = 6;// the button that will be on the stand itself
int holdTrafficLed = 7; // This led will light up as an indicator for when the user is using the support stand and the traffic is on hold
int MotorRTL;// this int will have the pin of the motor and the pins for the H-bridge
int MotorLTR;// this int will have the pin of the motor and the pins for the H-bridge
void setup() {
// put your setup code here, to run once:
pinMode(greenLight,INPUT); // greenLight is an INPUT because we are recieving this information from the already existing traffic light. therefore it can't be an OUTPUT.
pinMode(buttA, INPUT);
pinMode(buttB, INPUT);
pinMode(buttSideA, INPUT);
pinMode(buttSideB, INPUT);
pinMode(lowButt, INPUT);
pinMode(supportStandButt, INPUT);
pinMode(holdTrafficLed, OUTPUT);
pinMode(MotorRTL,OUTPUT);
pinMode(MotorLTR,OUTPUT);
}
void loop() {
// put your main code here, to run repeatedly:
if (greenLight() == true) {
if (whichSideWalkButt() == true) {
raiseSideA(true);
while(supportHeld() == false) {
if (greenLight() == false) {
raiseSideA(false);
}
else {
raiseSideA(true);
}
}
holdTraffic();
moveSupportStand(true);
raiseSideB(false);
}
else if (whichSideWalkButt()== false) {
raiseSideB(true);
while(supportHeld() == false) {
if (greenLight() == false) {
raiseSideB(true);
}
else {
raiseSideB(true);
}
}
holdTraffic();
moveSupportStand(false);
raiseSideA(false);
}
}
}
bool whichSideWalkButt() { //true=the button on sidewalk A was pressed. false=the button on sidewalk B was pressed.
if (digitalRead(buttA,HIGH)){ <----- this is the line with the error
return true;
else{
}
}
else if (digitalRead(buttB,HIGH)){
return false;
else{
}
}
}