I am a super newbie to arduino, hardware and this type of coding. All i know is i want to have a motor run but only if all three buttons are pressed to make a game. Does anyone have any idea how to achieve this? I know how to make a motor run by pressing just one button.
buttonAstate = digitalRead(buttonApin);
buttonBstate = digitalRead(buttonBpin);
buttonCstate = digitalRead(buttonCpin);
// assuming a button reads LOW when pressed
if (buttonAstate == LOW and buttonBstate == LOW and buttonCstate == LOW) {
motorMayStart = true;
}
if (motorMayState == true) {
// code to make the motor work
}
Always show us your current ‘complete’ attempt at a sketch.
Use CTRL T to format your code.
Attach your sketch between code tags [code]Paste your sketch here[/code]