I tried in a lot of different approaches, but nothing did work.
I thought this way would work:
public class HelloWorld
public static void Main()
OutputPort target_LED = new OutputPort;
target_LED = new OutputPort((Cpu.Pin)FEZ_Pin.Digital.Di26, false);
InputPort newball_but = new InputPort((Cpu.Pin)FEZ_Pin.Digital.Di39, true, Port.ResistorMode.PullUp);
if (newball_but.Read() == false)
I just took one LED and one Button to try if it works.
But what I want is that there is one bonus-button and 5 other buttons with each one with one LED with the same number.
(button1 + led1, button2 + led2, button3+ led3, … )
When the bonus-button is hit, a random number will be choosen and the LED with that number goes ON (true).
when the player hits the button with the same number, the score will add 40 points.
The number will be randomly choosen with:
Random random_gen = new Random();
int random_number = random_gen.Next(5);
the LED with that number will go on with this code:
if (targetBonus_but.Read() == false)
And I thought I needed this code to give the player 40 points when he hits the button with the LED that is on. (with the same number)
if (target_LED[random_number].Read() == true && target_but[random_number].Read() == false)
score += 40;
And when the player hits a button whit an LED that is OFF, he will get 20 points. For that part I use this code
if (target_but.Read() == false || target_but.Read() == false || target_but.Read() == false || target_but.Read() == false || target_but.Read() == false)
score += 20;
But the score doesn’t add 40 in stead of 20 when the player hits the button with the LED that is on (it just adds 20…)
So can someone help me to get this done?
(I’m sorry if my english is bad or someone doesn’t understand me. I’m dutch and tired at the moment. So my brains don’t work that good )