Problem Cheat button

Hey guys,

so I need help with my project for school. We are using Arduino now for 5 weeks or so. So I still don't fully understand the codes and how I need to program it.

Now we need to make a digital dice like this one (Digital Dice using Arduino ). We just used the code that they also used. (see Attachments)

But now the teacher said to us that we need to program a cheat button. What does he mean with that? He means that we need to use 1 of the 2 buttons that we installed on the de breadboard. And we need to hold 1 of the 2 buttons for a couple of seconds , so he will always trow 6

I hope someone can help me

p.s

sorry for my bad Englisch i m Dutch

Project_school.ino (1.08 KB)

Divide the problem into two parts:

  1. setting cheat mode
  2. altering the displayed result, so in cheat mode it is always 6.

You can simulate cheat mode by hard coding a boolean variable

bool cheatMode = true ;

Then get the display part working. After that, program the buttons to set cheat mode.

i dont know how to program the buttons to set cheat mode.

This is my first time programming in arduino. So i just a noob in programming. i just don't know how i program the buttons

Divide the button setting activity into 5 parts:

  1. Choose an arduino pin (not 0,1 or any pin used by the dice) for the button.
  2. Wire the button between the chosen pin and ground.
  3. Use pinMode() to add a pullup resistor.
  4. use digitalRead() to test if the button has been pressed.
  5. Use an "if" statement to determine what action to take depending on whether the button has been pressed.

i just don't know how i program the buttons

Study a couple of the many Arduino button tutorials on line. Google "Arduino button" to find them.