I’m trying to make an auton selector where you can press different buttons to make different combinations for an auton. The only solution I have thought of is to write a lot of if statements for which button is pushed to then add the function in a sequence, but I was wondering if there was a simpler solution that could produce a bunch of auton combinations without me having to write a bunch of if statements. The buttons work its just the combos that is the problem.
Code is below
Button File
// Button definitions
button buttons[] = {
{ 30, 30, 60, 60, false, 0xE00000, "Neutral" },
{ 150, 30, 60, 60, false, 0xE00000, "WP" },
{ 270, 30, 60, 60, false, 0xE00000, "Rings" },
{ 390, 30, 60, 60, false, 0xE00000, "Combined" },
{ 30, 150, 60, 60, false, 0x0000E0, "B1" },
{ 150, 150, 60, 60, false, 0x0000E0, "B2" },
{ 270, 150, 60, 60, false, 0x0000E0, "B3" },
{ 390, 150, 60, 60, false, 0x0000E0, "B4" }
};
I just included the definitions of the buttons because the rest of the code works
Autons File
void autons(int ){
if(buttons[].state == true){
n();
}
}
Any suggestions would be great