building a dice game (code problem)

:zipper_mouth_face: From "Examples" In Chapter 3 "Building Binary Dice" . I have managed to load and see the separate parts of the chapter working on my breadboard. However, the last part of the project "The final version" of the binary code has some serious problems for me in that nearly every line from ["Line 20] onwards will not "verify" in the IDE. I have checked my typing for errors so it's not Syntax . I am convinced there are parts of the code missing. Although a novice in programming, I am not a dummy, just someone who needs a helping hand for which, I would be most grateful. Thanks in anticipation solderman39 Victor based in the UK

I am convinced there are parts of the code missing.

You haven't posted your code or the errors messages, so I'd agree that there is something missing. I won't agree that it is missing from the code shown in the book, though, without knowing what book you are referring to or what your code looks like.

Hey PaulS, thank you for answering my post.

Here is a link that will take you to the project i am trying to do which is contained in the downloaded files when I bought the Ardiuno UNO .

From Google search page, type in;

"" you can see the complete code there.

Could you please advise me of any changes that need to be made to make it work. Any advice would be greatly appreciated . Many Thanks solderman39 Victor

Rather than have us look at links, why don't you post the exact code that you can see? Don't forget to use code tags.

#include <Bounce.h>

const unsigned int LED_BIT0 = 12;
const unsigned int LED_BIT1 = 11;
const unsigned int LED_BIT2 = 10;
const unsigned int START_BUTTON_PIN = 5;
const unsigned int GUESS_BUTTON_PIN = 7;
const unsigned int BAUD_RATE = 9600;

void setup() {
pinMode(LED_BIT0, OUTPUT);
pinMode(LED_BIT1, OUTPUT);
pinMode(LED_BIT2, OUTPUT);

const unsigned int DEBOUNCE_DELAY = 20;
Bounce start_button(START_BUTTON_PIN, DEBOUNCE_DELAY); //
Bounce guess_button(GUESS_BUTTON_PIN, DEBOUNCE_DELAY); //
int guess = 0;

void loop() {

void handle_guess_button() {
if (guess_button.update()) {
if ( == HIGH) {
guess = (guess % 6) + 1; //
Serial.print("Guess: ");

void handle_start_button() {
if (start_button.update()) {
if ( == HIGH) {
const int result = random(1, 7);
Serial.print("Result: ");
if (guess > 0) {
if (result == guess) {
Serial.println(“You win!”);
} else {
Serial.println(“You lose!”);
guess = 0;

void output_result(const long result) {
digitalWrite(LED_BIT0, result & B001);
digitalWrite(LED_BIT1, result & B010);
digitalWrite(LED_BIT2, result & B100);

void hooray() {
for (int i = 0; i < 3; i++) {

Do you have Bounce.h on your PC and if so where is it located ?

I have downloaded "Bounce.h" There are two versions of it , the second being a modified code of the first.

It think I am doing the wrong thing by leaving the code ("Bounce.h") in a "block" at the very beginning of the coding, when maybe it needs to be broken up and inserted into the various parts of the code sequence.

I have posted the code in full (see my previous posts) and here I heve posted the the second edition of "Bounce.h".

Debouncer Debounce(unsigned long interval_millis, uint8_t pin);

interval(interval_millis); previous_millis = millis(); state = digitalRead(pin); this->pin = pin; }

// Contributed by Jim Schimpf void Debounce::write(int new_state) { state = new_state; digitalWrite(pin,state); }

void Debounce::interval(unsigned long interval_millis) { this->interval_millis = interval_millis; }

int Debounce::update() { uint8_t newState = digitalRead(pin); if (state != newState ) { if (millis() - previous_millis >= interval_millis) { previous_millis = millis(); state = newState; return 1; } }

return 0;

If you can help it would be great to finish this project ! Thanks.......solderman39