# Arduino IDE problem - showString( )

**URL:** <https://community.openenergymonitor.org/t/arduino-ide-problem-showstring/8597>\
**Category:** Getting Started\
**Created:** [23 September 2018 23:33 UTC](https://community.openenergymonitor.org/t/arduino-ide-problem-showstring/8597 "2018-09-23T23:33:08Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![johnbanks](https://community.openenergymonitor.org/letter_avatar_proxy/v4/letter/j/c6cbf5/32.png) [@johnbanks](https://community.openenergymonitor.org/u/johnbanks)\
**Post date:** [23 September 2018 23:33 UTC](https://community.openenergymonitor.org/t/arduino-ide-problem-showstring/8597/1 "2018-09-23T23:33:08Z")

</div>

Some weeks ago I decided to become familiar with the Arduino IDE method for updating an emonTx firmware/sketch.

I installed it on my Windows laptop together with the required Libraries.

I was successful in burning the latest 3 phase sketch with Calibration constants which I had determined after a few experiments. It all worked perfectly well.

Today I decided to further adjust the Calibration constants and made the necessary changes to the src.ino file.

I expected the updating process to be as simple and straightforward as previously but it was not …

When running Arduino IDE Verify, I get the following error messages …

~~\src\config.ino: In function ‘void readInput()’:

config:165:25: error ‘showString’ was not declared in this scope

showString(helpText1);

Then a similar error …

In function ‘bool config(char)’:

config:239:29: error ‘showString’ was not declared in this scope

showString(helpText1);

I am at a loss to understand as I’m using the same procedure that worked a few weeks ago.

I’m using SERIALOUT (line 74 of src.ino) and notepad ++ to make changes to & save files.

Searching the Forum for config.ino, I found nothing relevant except for a ‘Much improved version by Robert Wall #6’. I tried this but it still threw errors on Verify.

Any suggestions/help – most welcome

Thanks  
John Banks

---

<div class="post-metadata">

**Author:** ![Robert.Wall](https://community.openenergymonitor.org/user_avatar/community.openenergymonitor.org/robert.wall/32/38246_2.png) [@Robert.Wall](https://community.openenergymonitor.org/u/Robert.Wall)\
**Post date:** [23 September 2018 23:57 UTC](https://community.openenergymonitor.org/t/arduino-ide-problem-showstring/8597/2 "2018-09-23T23:57:16Z")

</div>

Is the showString(…) function still present in the config.ino file (right at the bottom), or has it been accidentally edited out?

I too use NP++ (in preference to the in-built editor), so that in itself is not the culprit.

The correct config.ino was bundled with the main sketch, along with the documentation, in a zip file - I believe all the contents thereof have since been separated - I know not why, so maybe someone had married the wrong config.ino to the sketch.

Here’s the distribution as it left me:  
[emonTx\_3Phase\_PLL\_V1.2.zip](https://community.openenergymonitor.org/uploads/default/original/2X/3/362d04b1a1e3c774c0ad1fb0ca763108bfc4d30a.zip) (216.0 KB)

---

<div class="post-metadata">

**Author:** ![johnbanks](https://community.openenergymonitor.org/letter_avatar_proxy/v4/letter/j/c6cbf5/32.png) [@johnbanks](https://community.openenergymonitor.org/u/johnbanks)\
**Post date:** [24 September 2018 00:33 UTC](https://community.openenergymonitor.org/t/arduino-ide-problem-showstring/8597/3 "2018-09-24T00:33:44Z")

</div>

Robert …  
Thx for yr incredibly fast response.  
Your zipped config.ino looks similar to the one I was using.  
However I have just tried yr zipped version.  
Unfortunately - I get the same showString errors.  
Thx again - it’s late - I’m to bed

---

<div class="post-metadata">

**Author:** ![Bill.Thomson](https://community.openenergymonitor.org/user_avatar/community.openenergymonitor.org/bill.thomson/32/1834_2.png) [@Bill.Thomson](https://community.openenergymonitor.org/u/Bill.Thomson)\
**Post date:** [24 September 2018 01:34 UTC](https://community.openenergymonitor.org/t/arduino-ide-problem-showstring/8597/4 "2018-09-24T01:34:16Z")

</div>

> [@Robert.Wall](#):
>
> Here’s the distribution as it left me:

As a cross-check, I tried compiling the sketch. No errors.  
FWIW, I get the same errors the OP gets (line number references)  
if I comment out the showString function. (config tab)

---

<div class="post-metadata">

**Author:** ![Robert.Wall](https://community.openenergymonitor.org/user_avatar/community.openenergymonitor.org/robert.wall/32/38246_2.png) [@Robert.Wall](https://community.openenergymonitor.org/u/Robert.Wall)\
**Post date:** [24 September 2018 10:50 UTC](https://community.openenergymonitor.org/t/arduino-ide-problem-showstring/8597/5 "2018-09-24T10:50:26Z")

</div>

> [@Bill.Thomson](#):
>
> I get the same errors the OP gets (line number references)  
> if I comment out the showString function. (config tab)

@Bill.Thomson  
That figures, as the error message means it can’t find the definition of the function. (The Arduino IDE doesn’t require a _declaration_ of the function, like most compilers.)

Which begs the question:  
@johnbanks  
You haven’t loaded any other IDE, have you? Because there’s one, heavily promoted, which screwed up badly and moved directories and files around when I tried it out. And that could easily cause untold errors.

In the Arduino IDE, have you got 3 tabs and 3 files:  
“emonTx\_3Phase\_PLL”, “config” and “rfm”?  
Those 3 files all need to be in the same directory, called “emonTx\_3Phase\_PLL”

And have you disabled the internal editor in the Arduino IDE? (File → Preferences → Settings → Use external editor)

> [@johnbanks](#):
>
> Your zipped config.ino looks similar

I trust you know about the “Compare” plug-in for NPP?

---

<div class="post-metadata">

**Author:** ![johnbanks](https://community.openenergymonitor.org/letter_avatar_proxy/v4/letter/j/c6cbf5/32.png) [@johnbanks](https://community.openenergymonitor.org/u/johnbanks)\
**Post date:** [24 September 2018 13:53 UTC](https://community.openenergymonitor.org/t/arduino-ide-problem-showstring/8597/6 "2018-09-24T13:53:29Z")

</div>

It works for you guys and it worked for me a couple of weeks ago.

I figured it must be my Arduino IDE installation or the way I’m using it so …

So I’ve re-installed Arduino IDE (now 1.8.7) and the Libraries - jeelib, emonlib,one wire & Dallas temp.  
I used Robert’s zipped files (above) - unzipped them then had to remove ‘\_v1.2’ from the folder name to get the 3 tabs and 3 files.  
I made no other changes except for Preferences - verbose, line numbers and external editor.

I ran Verify but still got the same showString errors on lines 165 & 239 of config.ino

Do I need helpText1?  
If viable - which lines should I delete from config.ino to work around this problem?

Thanks  
PS - I’ve also installed the Compare plugin for Notepad ++

---

<div class="post-metadata">

**Author:** ![Robert.Wall](https://community.openenergymonitor.org/user_avatar/community.openenergymonitor.org/robert.wall/32/38246_2.png) [@Robert.Wall](https://community.openenergymonitor.org/u/Robert.Wall)\
**Post date:** [24 September 2018 14:18 UTC](https://community.openenergymonitor.org/t/arduino-ide-problem-showstring/8597/7 "2018-09-24T14:18:59Z")

</div>

There must be something about your installation that isn’t quite right.

This is a long shot:  
Look through the Arduino installation instructions in Learn [Learn | OpenEnergyMonitor](https://learn.openenergymonitor.org/electricity-monitoring/arduino-ide/windows10ide) and especially [Learn | OpenEnergyMonitor](https://learn.openenergymonitor.org/electricity-monitoring/arduino-ide/windows10lib) just in case there’s something not in the correct place, though I don’t see how that would account for the error you’re seeing.

It comes back to the compiler can’t see the function:

```auto
static void showString (PGM_P s) {
  for (;;) {
    char c = pgm_read_byte(s++);
    if (c == 0)
      break;
    if (c == '\n')
      Serial.print('\r');
    Serial.print(c);
  }
}

```

yet it must be reading and parsing the file to generate the error message.  
There has to be something wrong in the file **above** that function definition that’s preventing the compiler from finding it.  
I’m using V1.8.1 under Ubuntu Linux, but I can’t see anything in the release notes that might be relevant.

You do want showString, because it gives you the help text for configuring & saving to EEPROM. If you can’t get it to work, commenting those two lines that throw the error should get you going.

---

<div class="post-metadata">

**Author:** ![johnbanks](https://community.openenergymonitor.org/letter_avatar_proxy/v4/letter/j/c6cbf5/32.png) [@johnbanks](https://community.openenergymonitor.org/u/johnbanks)\
**Post date:** [24 September 2018 20:20 UTC](https://community.openenergymonitor.org/t/arduino-ide-problem-showstring/8597/8 "2018-09-24T20:20:23Z")

</div>

In an attempt to get going, I commented out lines 165 & 239 in config.ino with the following result …  
config .ino then threw an error at line 240

I then commented out line 240 and things progressed a bit …  
emonTx\_3Phase\_PLL.ino threw errors at lines 370, 472 & 868  
config.ino threw a new error at line 274  
and rfm.ino threw an error at line 151

As I am not using Radio, I modified emonTx\_3Phase\_PLL.ino with my specifics …  
Line 74 SERIALOUT  
Line 98 node 13  
Line 123 // commented out as CT4 not used  
Line 125 // commented out for normal LED behaviour  
and Line 133 changed to 45 as CT4 not used

Things progressed a bit further and I now got the following errors …

Arduino: 1.8.7 (Windows 10), Board: "Arduino/Genuino Uno"

C:\Users\johnb\Documents\Arduino\emonTx\_3Phase\_PLL\emonTx\_3Phase\_PLL.ino: In function ‘void loop()’:

emonTx\_3Phase\_PLL:472:18: error: ‘getCalibration’ was not declared in this scope

getCalibration();

^

C:\Users\johnb\Documents\Arduino\emonTx\_3Phase\_PLL\config.ino: In function ‘bool config(char)’:

config:274:1: error: a function-definition is not allowed here before ‘{’ token

{

^

config:379:1: error: expected ‘}’ at end of input

}

^

exit status 1

‘getCalibration’ was not declared in this scope

Do I need getCalibration() ? - if not, which lines should I comment out ?

Do you have any further suggestions regarding the 2 errors still thrown by config.ino

Or has my commenting lines created a vicious circle of errors?

Thanks

---

<div class="post-metadata">

**Author:** ![Greebo](https://community.openenergymonitor.org/user_avatar/community.openenergymonitor.org/greebo/32/4556_2.png) [@Greebo](https://community.openenergymonitor.org/u/Greebo)\
**Post date:** [24 September 2018 21:20 UTC](https://community.openenergymonitor.org/t/arduino-ide-problem-showstring/8597/9 "2018-09-24T21:20:00Z")

</div>

Can you upload a zip of the source files you’ve edited? Maybe give it a name of “sketch\_failing.zip” so it doesn’t confuse others who may find it in future and think its a working version.

---

<div class="post-metadata">

**Author:** ![Robert.Wall](https://community.openenergymonitor.org/user_avatar/community.openenergymonitor.org/robert.wall/32/38246_2.png) [@Robert.Wall](https://community.openenergymonitor.org/u/Robert.Wall)\
**Post date:** [24 September 2018 22:38 UTC](https://community.openenergymonitor.org/t/arduino-ide-problem-showstring/8597/10 "2018-09-24T22:38:09Z")

</div>

> [@johnbanks](#):
>
> Or has my commenting lines created a vicious circle of errors?

I think you’ve possibly taken too much out.  
When you edited line 240, you should have left an empty statement after the `default:` condition, i.e.

```auto
      default:
        showString(helpText1);
    } //end switch

```

should become

```auto
      default:
        ;
    } //end switch

```

Yes, that semicolon is an empty statement. (Without it, the compiler got lost, which provoked the other errors.) Then restore everything you did after that, and see where we are. If it still complains that `getCalibration` is not declared, we’re back to the original problem again, because by removing showString, all we’ve done is move the problem a bit further on, but it’s still the case that the config.ino file is not getting read properly and the functions in it aren’t being found.

I’m going to download the same version of the IDE shortly and install that, and see what happens.

---

<div class="post-metadata">

**Author:** ![johnbanks](https://community.openenergymonitor.org/letter_avatar_proxy/v4/letter/j/c6cbf5/32.png) [@johnbanks](https://community.openenergymonitor.org/u/johnbanks)\
**Post date:** [24 September 2018 23:05 UTC](https://community.openenergymonitor.org/t/arduino-ide-problem-showstring/8597/11 "2018-09-24T23:05:40Z")

</div>

In response to @Greebo here’s the requested zip file …

[Failing\_3Phase\_Sketch.zip](https://community.openenergymonitor.org/uploads/default/original/2X/4/4f4c043e278ec2e0efa9e4322e093de9fd546306.zip) (235.1 KB)

I’ll now try Robert Wall’s latest suggestions

And thank you all for your help

---

<div class="post-metadata">

**Author:** ![Robert.Wall](https://community.openenergymonitor.org/user_avatar/community.openenergymonitor.org/robert.wall/32/38246_2.png) [@Robert.Wall](https://community.openenergymonitor.org/u/Robert.Wall)\
**Post date:** [24 September 2018 23:17 UTC](https://community.openenergymonitor.org/t/arduino-ide-problem-showstring/8597/12 "2018-09-24T23:17:14Z")

</div>

BINGO!  
Having just installed Arduino IDE V1.8.7:

… In function ‘void readInput()’:  
config:165:29: error: ‘showString’ was not declared in this scope  
showString(helpText1);

So it’s NOT you and it’s NOT my sketch - it’s the IDE.  
Can you revert to V1.8.1 - which is the version I was using?

Next question: Why? and what can be done about it? It won’t be good to consolidate everything into the one file, but that’s probably the work-around.

---

<div class="post-metadata">

**Author:** ![Robert.Wall](https://community.openenergymonitor.org/user_avatar/community.openenergymonitor.org/robert.wall/32/38246_2.png) [@Robert.Wall](https://community.openenergymonitor.org/u/Robert.Wall)\
**Post date:** [24 September 2018 23:29 UTC](https://community.openenergymonitor.org/t/arduino-ide-problem-showstring/8597/13 "2018-09-24T23:29:53Z")

</div>

All it needs is a **declaration** of showString, in the main file:

`static void showString (PGM_P s);`

I usually insert those just above the first executable statement, viz:

```auto
OneWire oneWire(W1PIN);

static void showString (PGM_P s);

void setup()
{
... etc

```

Now why does this version need it, and V1.8.1 didn’t, and why does it not need definitions of all the other functions in the supporting files?

Methinks it’s a bug. In previous versions, the _definition_ sufficed.

---

<div class="post-metadata">

**Author:** ![johnbanks](https://community.openenergymonitor.org/letter_avatar_proxy/v4/letter/j/c6cbf5/32.png) [@johnbanks](https://community.openenergymonitor.org/u/johnbanks)\
**Post date:** [25 September 2018 15:09 UTC](https://community.openenergymonitor.org/t/arduino-ide-problem-showstring/8597/14 "2018-09-25T15:09:38Z")

</div>

Robert …

My problem is now solved with your updated sketch.

(See: Update to 3-Phase PLL sketch - a separate posting on this Forum)

I’ve successfully uploaded the revised sketch incorporating my particular changes (SERIALOUT, node number, etc).

Many thanks for your speedy diligence

---

<div class="post-metadata">

**Author:** ![Robert.Wall](https://community.openenergymonitor.org/user_avatar/community.openenergymonitor.org/robert.wall/32/38246_2.png) [@Robert.Wall](https://community.openenergymonitor.org/u/Robert.Wall)\
**Post date:** [25 September 2018 20:28 UTC](https://community.openenergymonitor.org/t/arduino-ide-problem-showstring/8597/15 "2018-09-25T20:28:41Z")

</div>

The newer IDE appears to compile more efficiently, but importantly the declaration of showString( ) doesn’t generate an error in the older IDE V1.8.1.

 ![image](https://community.openenergymonitor.org/uploads/default/original/2X/d/dcfdfc52ee6ac384154993189169642b3d84919e.png)

---

<div class="post-metadata">

**Author:** ![johnbanks](https://community.openenergymonitor.org/letter_avatar_proxy/v4/letter/j/c6cbf5/32.png) [@johnbanks](https://community.openenergymonitor.org/u/johnbanks)\
**Post date:** [25 September 2018 21:45 UTC](https://community.openenergymonitor.org/t/arduino-ide-problem-showstring/8597/16 "2018-09-25T21:45:02Z")

</div>

Hopefully my travails and your efforts will be of benefit to others.  
And I do hope a way is found to make the latest versions of sketches more readily accessible in the RESOURCES section of the website - that would benefit others too.
