'class String'has no memeber names 'setArray'

Okay so, some sample code that was linked to a hackaday post im guessing is out of date. I new to programming and was hoping someone could help me (:

Errors:
sketch_jul22b.cpp: In function ‘void displayFrequency(long int)’:
sketch_jul22b:250: error: ‘class String’ has no member named ‘setArray’
sketch_jul22b:277: error: ‘class String’ has no member named ‘getArray’

Specific line:
lcdOutput.setArray(“108.0MHZ”); // Just a template…

I hope this is clear enough and that i have provided all the info that is needed. If you with to view the full sample code it can be found here…http://mikeyancey.com/files/arduino-fm/ARRduino_FM_v1/ARRduino_FM.pde … The only thing i knew i had to change, and have changed is TextString to String.

Class string does not have that member AFIAK, you have declared "lcdOutput" as a TextString, what is that. Presumably not a String.

If you just changed TextString to String and String doesn't have setArray/getArray member then it won't work.


Rob

Thanks for the reply Rob, any suggestions for me to solve the problem? As i have litrally no experience with programming, any chance you or someone could have a look at the original code and give me some clues to fix the error?

Thanks again,

Jack

I had no idea what class TextString was so went and had a look. Looks like it’s been replaced by String and String doesn’t have those two members, normally in that case I would look at the code for get/setArray in the old class, see what it does and see if there’s a member in the new class that does the same thing.

Unfortunately TextString doesn’t appear to have those members either so I don’t know where that code you have got them from.

I’ll have a look at your code and see if I can see what it’s doing and recommend a change.


Rob

Looking at the code it seems that all get/setArray does is an assignment, so I think you can make the following substitutions

 TextString lcdOutput = TextString( 9 );
 lcdOutput.setArray("108.0MHZ" );    // Just a template...

to

TextString lcdOutput;
lcdOutput= "108.0MHZ";    // Just a template...

and

lcd.printIn( lcdOutput.getArray() );

to

lcd.printIn( lcdOutput );

The only other member you use is setCharAt() and this does seem to be supported by the String class.

EDIT: Actually you overwrite the "108.0MHZ" anyway in the following code so there's no point assigning that default string.


Rob

Thanks Rob, ill have a play with this next monday and ill post if it all works.

Thanks again,

Jack