Go Down

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

jjeffh

My 10 year-old grandson and I are both new to Arduino. I want to prepare a project to do with him for Christmas, and I found Joe Coburn's Buzz Wire Game on Make Use Of from 9/21/16.

It looks like something he could get into and we could do together, but I can't get the code he posted to work.

He refers to pitches.h and I followed the instructions for creating a new tab and copying in the code. But when I compile, I get an error "No such file or directory", even though I see it in the Arduino\BuzzWire folder along with BuzzWire.ino.

He also gives instructions for bringing in and editing TM1637.cpp. The editing is to expand the numbers and letters that can be displayed. However, I'm also getting an error on this, both with and without the edits. When he explains the editing he says to edit .cpp and not .h, but the code includes the line "#include <TM1637.h>" and that's where the error occurs.

I am working from the Arduino Starter Kit and I've already ordered the additional items needed for this project, but I'm hoping someone can help me with the coding.

Thanks!
- Jeff

groundFungus

#1
Dec 12, 2018, 09:07 pm Last Edit: Dec 12, 2018, 09:07 pm by groundFungus
Read the how to use this forum sticky to see how to post code and error messages.  It will go a lot faster if you know and follow the guidelines.

Then post the code that you are having trouble with and the entire text of the error message(s) and we can help.

Which Arduino board are you using?

jjeffh

Read the how to use this forum sticky to see how to post code and error messages.  It will go a lot faster if you know and follow the guidelines.

Then post the code that you are having trouble with and the entire text of the error message(s) and we can help.

Which Arduino board are you using?
Thanks, groundFungus. Sorry for not providing enough information. I had read "How to Post", but I was trying to summarize and get direction before dumping all the code. I'm using an Arduino Uno (from the Starter Kit). [And now, after I had added all the code, I got the forum error "Exceeding 9000 characters". I'm not really sure what is needed in order to isolate the problem, but I'm minimizing it now. Please let me know what is needed.]

I had posted the full code from Coburn's project instructions, but below are just the first few lines, which are getting the errors. I'm also posting the error messages for pitches.h, and the code for TM1367 (which it says is installed when I search for it in Manage Libraries).

The first few lines of Coburn's code for the project:
Code: [Select]
#include <TM1637.h> // include display library
#include <pitches.h> // include pitches

TM1637 *_display = new TM1637(12, 13); // create display object, 12 = CLK (clock), 13 = D10 (data)

// etc. ...


When I compile Coburn's code, the first line returns the error:
Code: [Select]
Arduino: 1.8.8 (Windows Store 1.8.19.0) (Windows 10), Board: "Arduino/Genuino Uno"

BuzzWire:1:47: error: TM1637.h: No such file or directory

compilation terminated.

exit status 1
TM1637.h: No such file or directory

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.


When I rem that line out and recompile, the second line returns this error:
Code: [Select]
Arduino: 1.8.8 (Windows Store 1.8.19.0) (Windows 10), Board: "Arduino/Genuino Uno"

BuzzWire:2:40: error: pitches.h: No such file or directory

compilation terminated.

exit status 1
pitches.h: No such file or directory

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.



Should I also include the code for pitches.h and TM1637.cpp?



groundFungus

#3
Dec 13, 2018, 12:33 am Last Edit: Dec 13, 2018, 12:45 am by groundFungus
I followed the instructions in the  Joe Coburn's Buzz Wire Game page that you linked and get the same errors.  I installed the TM1637 library through the library manager.  In the TM1637 library folder are TM1637Display.h (and TM1637Display.cpp) instead of the TM1637.h file that the program is #including.  I believe that that is the source of the error.

OK, I got it to compile, but cannot test.  Here is what I did.

Since the library downloaded from the library manager did not seem to be the right one I started looking for an alternative.  The page mentioned that the library was written by Seeed so I looked there.  There is a library for the TM1637 there.    Download the zip file of the library form this page.  Once downloaded, go to Sketch, Include Library, Add Zip Library.  Click that and navigate to where the downloaded zip file is. Double click the
Seeed_Grove_4Digital_Display_g-master.zip file and it will be installed.

If you have not, copy the pitches.h file into a tab in your program in the IDE and name the tab pitches.h. 
Change the line #include <pitches.h> to #include "pitches.h".

The program should compile.  If successful, make the changes to the .ccp file and try again.  The TM1637.cpp file will be in the Seeed_Grove_4Digital_Display_g-master folder in the libraries folder (not a TM1637 folder like the page says).

jjeffh

Wow! Thanks very much. I haven't tried it yet, but I will do so tomorrow and report back.

- Jeff

jjeffh

Those are excellent and clear instructions, groundFungus. This worked perfectly! Many thanks.

I have not built the circuit yet, but I'm expecting the components I need to arrive today so hopefully all will go well.

Again, thanks! This is my first posting, so I don't know how the "karma" feature works, but I'm going to try it now.

- Jeff


groundFungus

Thank you for the feedback.  If you have trouble with the project once you get the parts, I will be glad to help.

jjeffh

Well, I don't know if this should be a new thread, but I'm building the circuit now and just realized the starter kit has an LCD display but the project uses a 7-segment display. Coburn specifically references a Seeed model which won't ship until December 23rd and will cost $20 to arrive in 1-3 days, or $5 to arrive in 10-28 days after that.

So I have two questions:

1. Could I adapt Coburn's code to the LCD display (with the understanding that I'm a know-nothing beginner)?

2. Could I use this Adafruit model from Amazon, which will be here Saturday for free through Prime? And if so, is this description enough to indicate I'm likely to be able to connect it as Coburn describes:
Quote from: Amazon
I2C Backpack (Requires Soldering) that allows the display to be driven with just 4 pins!
Setup guide and Arduino libraries available from Adafruit
To clarify the situation, I'm trying to complete this project and test it now, so I can take it apart and redo it with my 10-year old grandson as a Christmas activity. There is a third option regarding the display: It's not essential to the project, so I could skip it for now and add it in later if the project goes well with my grandson.

groundFungus

#8
Dec 13, 2018, 09:10 pm Last Edit: Dec 13, 2018, 09:12 pm by groundFungus
Quote
1. Could I adapt Coburn's code to the LCD display (with the understanding that I'm a know-nothing beginner)?
I have looked at the code and believe that it will not be terribly difficult to modify the code to use an LCD.  The first challenge is to get the LCD to work by itself and display data that you hard code (the "hello world" example, for example). 

Can you post photos of the LCD from the starter kit so that I know what we are working with?  Front and back sides?

How to post images.

jjeffh

Here goes ...




groundFungus

OK, that is a "standard" 1602 display.  Can you install the hd44780 LCD library?  Use the library manager like you did with the TM1637 library.  Once the library manager window is open select displays in the Topic drop down and enter hd44780 in the Filter box.   Select and install the hd44780 by Bill Perry library.  

Looking at the photo of the front of the LCD, pin 1 is on the top left and pin 16 on the right.  The LCD is right side up in the photo.  Plug the LCD into your breadboard and wire the LCD as follows.

Uno pin                       LCD pin
ground                          1
Vcc(5V)                        2
see below1                 3
     11                             4
to ground                     5
      12                            6
                              7-10 not connected
      4                             11
      5                             12
      6                             13
      7                             14
Vcc(5V)                         15
see below2             16

1 tie pin 3 of the LCD to ground through a 1K resistor.  This sets the contrast.
2 Tie pin 16 of the LCD to ground through a 220 to 470 Ohm resistor.  This sets the backlight.

I will put some test code in the next post.  
 

groundFungus

Here is the test code.  This has been tested on my Uno with a 1602 16x2 LCD with 4 pin interface.

Code: [Select]
//Modified hd44780 library (by Bill Perry) "hello world" example.  Mod by C. Goulding

#include <hd44780.h>
#include <hd44780ioClass/hd44780_pinIO.h> // Arduino pin i/o class header

const int rs = 11, en = 12, db4 = 4, db5 = 5, db6 = 6, db7 = 7; // for all other devices

hd44780_pinIO lcd(rs, en, db4, db5, db6, db7);

// LCD geometry
const int LCD_COLS = 16;
const int LCD_ROWS = 2;

void setup()
{
   lcd.begin(LCD_COLS, LCD_ROWS);
   // Print a message to the LCD
   lcd.print("Hello, Jeff!");
}

void loop() {}

jjeffh

I think I have it wired correctly, but when I upload I get this error:
Code: [Select]
Arduino: 1.8.8 (Windows Store 1.8.19.0) (Windows 10), Board: "Arduino/Genuino Uno"

Sketch uses 3148 bytes (9%) of program storage space. Maximum is 32256 bytes.
Global variables use 108 bytes (5%) of dynamic memory, leaving 1940 bytes for local variables. Maximum is 2048 bytes.
avrdude: ser_open(): can't open device "\\.\COM3": The system cannot find the file specified.


Problem uploading to board.  See http://www.arduino.cc/en/Guide/Troubleshooting#upload for suggestions.

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

I see it's looking for COM3, but I'm using a different UNO for this and my computer automatically sets it up as COM4. I can't see where to change that.

Here is the wiring as I set it up. I've tied pins 4, 6, 11, 12, 13, and 14 to keep them out of the way and show the Grounding pins (1, 3, 16) and the Power pins (2 and 15). Pin 3 has a Brown/Black/Red resistor (1k) and pin 15 has a Red/Red/Brown (220).


jjeffh

Hold on!! I went into Device Manager and deleted COM4, refreshed, then deleted COM3, and rebooted. That cleared the ports and set up COM3 for this test. (So does Arduino require COM3? I'm using Windows 10.)

And it worked! "Hello, Back-at-you!" (I feel funny calling you groundFungus ... feels almost like an insult.  :smiley-confuse: )

So now I need to replicate these connections in my Buzz Wire project and replace Coburn's display code with your code, right?

You have been very patient with me and very much appreciate it. I'm hoping you are willing to bear with me a little longer because my initial tests with the project setup did not go that well. I want to bring this display in then retest and I might need to ask a couple more questions.

Many thanks,
- Jeff

groundFungus

Glad to know that the LCD works. 

You choose the com port in the Tools menu.  Click on Ports and the port that the Uno is connected to will show and can be selected.

It is a bit more complicated than just replacing a few lines to put the LCD in place of the 7 seg. display.  The data was written to the TM1637 a digit at a time, but with the LCD you can write the line at a time.  Use the setCursor() function to place the cursor on the character position and line that you want to write to.  Give me a little time and I will get started and post code later.

Go Up