Hello. im trying to make a program where i have 4 programs in one. let me explain;
i have a card with 9 LED - 4 buttons - 1 speaker - 1 swich - and a potentiometer.
i want to make smaller programs, where i use the stuff on the card to controll the LED and speaker the way i want. and make games ETC. but i want to make sort of a "lobby" where i go from one program to another.
so that the card is just laying there doing nothing but a lightshow to indicate that its waiting for a button to be pressed. once i press that button, a program will start. and it will keep running untill i press that button again. then it will go back to the lobby again and wait. here i have the option to press another button to start a game/program, or i can click again to do it again.
i need help btw.. cant come up with a way to do this. can someone help me?
code:
if (digitalRead(Knapp[0]) == 1)
{goto Chapter_1;}
if (digitalRead(Knapp[1]) == 1)
{goto Chapter_2;}
if (digitalRead(Knapp[2]) == 1) Knapp is norwegian for "button"
{goto Chapter_3;}
if (digitalRead(Knapp[3]) == 1)
{goto Chapter_4;}Chapter_1:
digitalWrite(Led[0], HIGH);
Chapter_2:
digitalWrite(Led[1], HIGH);
Chapter_3:
digitalWrite(Led[2], HIGH);
Chapter_4:
digitalWrite(Led[3], HIGH);
this code is bullshit.. but it gives an idea of what im thinking about.