My goal is to print a string variable with a library supplied with an LCD interface board
String g="Test"
mydisp.println(g);
This throws and error on the mydisp. line while compiling :
pingpair_sleepy.cpp: In function 'void lcdsetup()':
pingpair_sleepy:286: error: no matching function for call to 'DigoleSerialDisp_I2C::println(String&)'
C:\Users\Syd\Downloads\arduino-1.0.1-windows\arduino-1.0.1\libraries\DigoleSerialDisp/DigoleSerialDisp.h:36: note: candidates are: void DigoleSerialDisp_I2C::println(char*)
how do i reference the string variable g so that println() will display it on the lcd?
My best guess so far is - but it doesn't work - it compiles - but does not display
Why did the developers of Arduino create the String class when it is being strongly discouraged?
Do note that the posters that are discouraging the string class apparently can't modify the OP's origional code to support their method. String class useage debate is more likely a red herring diverting from the problem. My question to the OP would be have you actually gotten anything to display on the LCD?
From the OP: Yes - I used the suggestion char * p = "Test"; and am using that in a function call to print a string at a particular location on the LCD; I just pass in p and it works swimingly.
Being a C#/Java programmer as an avocation, string is the first thing I think of when a bunch of ascii needs displayed - I have to adjust my thinking now that I have seen how easy it is to pass around pointers.
When I start using the serial port in this project I will be using the buf[] version since I have no control over what might be coming in.
Why did the developers of Arduino create the String class when it is being strongly discouraged?
Do note that the posters that are discouraging the string class apparently can't modify the OP's origional code to support their method. String class useage debate is more likely a red herring diverting from the problem. My question to the OP would be have you actually gotten anything to display on the LCD?
I suspect that the folks discouraging the use of the Arduino string class are doing so because of the well documented memory leak/fragmentation problems.
What fits well on PC's don't always fit well on MCU's.
Why teach bad MCU habits when C strings are simple and give a complete set of functions that don't play with the heap or stack "for you". Learn pointers and ask why you ever used String Objects any way.
I suspect that the folks discouraging the use of the Arduino string class are doing so because of the well documented memory leak/fragmentation problems.
But that probably has nothing to do with the current problem. If they can fix the OP's code with their solution, then they should. If their solution doesn't fix the problem, then they are just overheating their BS grinders on a non issue. Just be glad they don't diagnose and repair problems on aircraft that your family flies on.