Hi there I'm a student looking for some help programming an 08M2 microcontroller for a specific function. I have lots of experience coding in python and java but BASIC is quite new to me and I can't find a way to define my own functions.
I have a circuit which has two input buttons and two output LEDs. The left button corresponds to the left LED and same for the right side. The premise is simple, a random sequence of length x (ideally x is as large as possible) is generated, possible values are either 1 or 0 for left led / right led.
Example sequence: left, right, right, right, left, left ...
The first entry in the list will flash so in this case the left LED.
If the left button is then pressed the sequence will play through the first two entrys, left LED and then right LED
If the left button and the right button is then pressed the first three entries of the list will play through and so on and so forth.
If the input is wrong a new sequence is generated and played once again from the first entry and if the entire sequence is correct a new sequence is generated and then played from the beginning.
If this is impossible im willing to remove progressive nature of 1LED flash, 2 LED flash etc... and just have a sequence of 10 flashes and compare input to the sequence and if incorrect repeat the sequence and try again or if correct create a new sequence to play.
I have a circuit which has two input buttons and two output LEDs. The left button corresponds to the left LED and same for the right side. The premise is simple, a random sequence of length x (ideally x is as large as possible) is generated, possible values are either 1 or 0 for left led / right led.
Example sequence: left, right, right, right, left, left ...
The first entry in the list will flash so in this case the left LED.
If the left button is then pressed the sequence will play through the first two entrys, left LED and then right LED
If the left button and the right button is then pressed the first three entries of the list will play through and so on and so forth.
If the input is wrong a new sequence is generated and played once again from the first entry and if the entire sequence is correct a new sequence is generated and then played from the beginning.
If this is impossible im willing to remove progressive nature of 1LED flash, 2 LED flash etc... and just have a sequence of 10 flashes and compare input to the sequence and if incorrect repeat the sequence and try again or if correct create a new sequence to play.