I am trying to create a sequence where the LED lights up sequentially for 200ms each. If the switch corresponding to the lighted LED is flipped within then 200ms, the LED turns off and the next LED turns on. However I can't seem to be getting what I want. Can somebody pls help me with this or tell me what errors I'm making? I've attached my file. Thanks
I hate to be the one to tell you this, and forgive me for being blunt, but your code is an absolute mess. This seems to be a whack-a-mole game implementation. What is the purpose of all those Boolean switches? Are those intended to be use to "whack the mole"? In what sequence are the LEDs supposed to light up? In a specific order? Randomly?
I would suggest reading up a bit on programming architectures, like the state machine. If this is supposed to be a "whack-a-mole" game then I would suggest using an event structure and handling the user clicking on the LED (by handling the MouseDown event on the LED), rather than having the user flip a switch.
You may also want to take a look at the XOR truth table.
If you have e.g. four LEDs, you could generate a random number at regsular intervals and, depeding on the value, light LED1 if the number is 0..0.1, LED2 (0.1..0.2), etc. and have them all off if the random number is 0.4..1.
Simply generate a random number using the "dice" from the numeric palette.