Go Down

Topic: Can't get Coburn's code for Buzz Wire Game to compile (Read 1 time) previous topic - next topic

jjeffh

After I set it up for the full Buzz Wire game and nothing happened (except Monty Python), then I left it all as you see it and uploaded your LCD code. That didn't work either. It would seem that I must be doing something wrong, but I sure can't see it.

But without changing anything and uploading my test code the LCD works?  
If the bottom rails are getting power the backlight should light.
FYI, Charlie, I found my mistake. I set up just the LCD display on a different UNO and board, using your display code and it worked perfectly as I tested it with different placements of text. So I revisited the full Buzz Game set up and I found that I had connected LCD pin 16 to power instead of ground!

Now I see "Buzz Ready" and when I press the button I get the countdown from 20 seconds, resulting in a chirp from buzzer 2 when it reaches 0. When I manually change the variable "mode" to 1 in the code, then I get your flashing "Free" and "Play".

However, I'm still not getting a buzz when I touch the two leads together, so I'll investigate that set up.

- Jeff

jjeffh

I have not found another stupid mistake like the last one (yet), but there's something about the code I don't understand.

I see "pinMode(9, INPUT)" specified in the code, but I don't see any other reference to pin 9 in the code. Doesn't there have to be some place where the code says that if pin 9 is HIGH the buzzer should sound and the game should end? Or is that handled in a different way?

Pin 9 is connected to the "course" which is connected through two 220 resistors. The setup shows the lead to pin 9 goes to 1e on the board, with a 220 resistor in 1d. The resistor goes to 5d and another 220 resistor goes from 5e to 9e. The course is connected at 5a, and row 9 is grounded.

The the handle lead is connected directly to power. So if that circuit is completed, pin 9 should be HIGH and the buzzer should sound. I just can't see where in the code pin 9's input is read and the buzzer activated.

groundFungus

Quote
The the handle lead is connected directly to power. So if that circuit is completed, pin 9 should be HIGH and the buzzer should sound. I just can't see where in the code pin 9's input is read and the buzzer activated.
Code: [Select]
   if (digitalRead(10) == HIGH)
   {
      delay(25);
      if (digitalRead(10) == HIGH)
      {
         while (digitalRead(10) == HIGH)
         {
            buzz(8, NOTE_B0, 1000 / 24); //[This was changed from 11 to 8]
         }
      }
   }

It looks to me like the 10 in that part of the code should be 9.  Why would one read the buzzer1 output?

jjeffh

You got it! That worked.

So that's the whole project: music, display, two modes, and the wire-touch buzz. Now I just have to cut the pieces for the game board and lay out a suitable procedure that Chance and I can work on together to built this thing.

Thanks so much, Charlie! I've learned quite a bit from you in this thread. I've been looking at the Tutorials Point C++ training online. Perhaps as I go through their tutorials I can work on this code to test things out.

A few things I'd like to do are: 1) start and stop, or at least lower the volume of, the music; 2) stop the game and display "Game Over" when the wand touches the course; and 3) change between Free Play and Challenge Mode on the board instead of in the code.

For now, I'm just delighted to see it all working and to know this Christmas plan is actually going to work.

I doubt we're allowed to add more than one karma point at a time, but I'm going to see if I can give you a couple extra. You've been great.

- Jeff

groundFungus

Thank you.  Glad you got it working.  Hope that you and Chance have as enjoyment with this hobby as i have.

Merry Christmas to you and your's.

Charlie

jjeffh

Thank you.  Glad you got it working.  Hope that you and Chance have as enjoyment with this hobby as i have.

Merry Christmas to you and your's.

Charlie
Merry Christmas to you, too.

- Jeff

Go Up