small medium large xlarge

Back to: All Forums  Arduino
Oppa2_pragsmall
27 Feb 2011, 12:39
Stephan Goldenberg (14 posts)

Hi,

I’m trying to get “Hello World” in morse code but (after correcting tons of syntax errors) the IDE is still throwing errors on me.

“/home/oppa/sketchbook/libraries/Telegraph/telegraph.cpp: In member function ‘void Telegraph::output_code(const char)’: /home/oppa/sketchbook/libraries/Telegraph/telegraph.cpp:29: error: ISO C++ forbids comparison between pointer and integer /home/oppa/sketchbook/libraries/Telegraph/telegraph.cpp: In member function ‘void Telegraph::send_message(const char)’: /home/oppa/sketchbook/libraries/Telegraph/telegraph.cpp:58: error: pointer to a function used in arithmetic /home/oppa/sketchbook/libraries/Telegraph/telegraph.cpp:58: error: pointer to a function used in arithmetic “

As I don’t know CPP I’m lost.

Arduino IDE 0022 on Debian Wheezy

Maik_schmidt_avatar2_pragsmall
27 Feb 2011, 12:55
Maik Schmidt (122 posts)

Hi Stephan!

The Telegraph example is meant to be used as a library. I’ve downloaded the zip file containing the book’s code five minutes ago and extracted it. Then I’ve copied the Telegraph folder to the Documents/Arduino/libraries folder, which is the folder for Arduino libraries on a Mac. I’ve deleted the file Telegraph.pde (because it does not belong to the library) and then I’ve restarted the IDE. Finally I’ve opened the “Hello, world!” example from the open dialog and compiled it successfully.

It’d be helpful, if you could walk through the same steps and see if this works for you. You can lookup the location of the libraries folder in the Preferences dialog (it’s called sketchbook location). If you do not have a subdirectory named ‘libraries’ in your sketchbook folder, create one using mkdir.

Best, Maik

Oppa2_pragsmall
27 Feb 2011, 15:56
Stephan Goldenberg (14 posts)

Hi Maik,

got all that :) It is in my libaries folder:

oppa@oppa-mag:~$ ls sketchbook/libraries/ Bounce/ Telegraph/ oppa@oppa-mag:~$ ls sketchbook/libraries/Telegraph/ telegraph.cpp telegraph.cpp~ telegraph.h

The way I se it the compiler is choking on: output_code(const char* code) and (const char* message)

Well, not knowing C(++) I was wondering too what the asterisk is for.

These are the lines 29 and 58:

29: if (code[i] == “.”) 58: } else if (isdigit[current_char - ‘0’]) {

Most useful would be an “SCREW ISO - DO IT!”-button :)

Maik_schmidt_avatar2_pragsmall
27 Feb 2011, 16:20
Maik Schmidt (122 posts)

Do you use double quotes in line 29? They have to be single quotes. Did you download the code or did you type it in yourself?

Oppa2_pragsmall
27 Feb 2011, 16:51
Stephan Goldenberg (14 posts)

Tried putting downloaded code into my global libraries folder and this works but I don’t know why. I’ve compared the files and found (and corrected) two more errors but still no joy.

So, two hours of reading and typing for the trash can… ;(

note to self: quit typing yourself - you’re just wasting time

Oppa2_pragsmall
27 Feb 2011, 17:07
Stephan Goldenberg (14 posts)

That was it, a poorly rendered PDF. It does look a bit like double quotes here.

Thanks Maik, Stephan

You must be logged in to comment