No idea what I am doing

Hi guys, I keep getting the same errors all the time.

They all seem to be related to this one :

ın function 'void loop()':

Here are the codes,and bellow the list of errors.Im very inexperienced about programming,and I dont have a clue on where's the error.Thanks in advance.

F:\weather_station_v2\weather_station_v2.ino: In function 'void loop()':

F:\weather_station_v2\weather_station_v2.ino:139:34: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

myGLCD.print("weather", i, 37);

^

F:\weather_station_v2\weather_station_v2.ino:148:46: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

myGLCD.print("MINI HAVA ISTASYONU", 7, 37);

^

F:\weather_station_v2\weather_station_v2.ino:149:44: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

myGLCD.print("SENSORLER OKUNUYOR", 8, i);

^

F:\weather_station_v2\weather_station_v2.ino:167:29: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

myGLCD.print("C",72,27);

^

F:\weather_station_v2\weather_station_v2.ino:169:29: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

myGLCD.print("o",70,22);

^

F:\weather_station_v2\weather_station_v2.ino:180:28: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

myGLCD.print("%",9,28);

^

F:\weather_station_v2\weather_station_v2.ino:192:31: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

myGLCD.print("hPa",40,43);

^

F:\weather_station_v2\weather_station_v2.ino:201:46: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

myGLCD.print("BASINC (SON 24 SAAT)",6,0);

^

F:\weather_station_v2\weather_station_v2.ino:202:35: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

myGLCD.print("1000 hPa",0,42);

^

F:\weather_station_v2\weather_station_v2.ino:203:35: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

myGLCD.print("1050 hPa",0,11);

^

F:\weather_station_v2\weather_station_v2.ino:345:46: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

myGLCD.print("BASINC (SON 24 SAAT)",6,0);

^

F:\weather_station_v2\weather_station_v2.ino:347:37: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

myGLCD.print("Ortalama: ",0,10);

^

F:\weather_station_v2\weather_station_v2.ino:349:35: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

myGLCD.print("Guncel: ",0,25);

^

F:\weather_station_v2\weather_station_v2.ino:351:33: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

myGLCD.print("Fark: ",5,40);

^

The error is most likely in you code.

Paul

Can you see the word "error" anywhere in the messages?

Those are warnings.

You need to understand the difference between warnings and errors. A warning is the compiler telling you there is something in the code that could possibly cause a problem but doesn't cause the compilation to fail. An error is a problem with the code that causes compilation to fail. In this case you have posted warnings not errors.

It's a good idea to pay attention to warnings but these specific warnings don't indicate any potential problem so you are welcome to ignore them. If you prefer to fix them we can also help with that.

A warning means the compiler made its best effort to understand your intentions, and while the code will load run -

  • the operation may not be what you expect - due to some misinterpretation.

Think of it like “My car is in the garage”
Is that in your garage (parking shed), or at the local gas station?
The compiler couldn’t tell which one.

pert:
You need to understand the difference between warnings and errors. A warning is the compiler telling you there is something in the code that could possibly cause a problem but doesn't cause the compilation to fail. An error is a problem with the code that causes compilation to fail. In this case you have posted warnings not errors.

It's a good idea to pay attention to warnings but these specific warnings don't indicate any potential problem so you are welcome to ignore them. If you prefer to fix them we can also help with that.

Thanks for the explaining between error and warning, so if i upload the code to the arduino will it cause a problem for me.

Hi,
Welcome to the forum.

Please post your code.

Please read the first post in any forum entitled how to use this forum.
http://forum.arduino.cc/index.php/topic,148850.0.html then look down to item #7 about how to post your code.
It will be formatted in a scrolling window that makes it easier to read.

Thanks.. Tom... :slight_smile:

El_Farouq:
if i upload the code to the arduino will it cause a problem for me.

Not based on the warnings you posted. I can't say whether there was more output you didn't bother to post.

"deprecated conversion from string constant to 'char*'" means this was something that used to be supported and still is but they're planning to stop supporting it in some future compiler version and so they're warning people that it might be a good idea to fix the code now while it still works rather than waiting for the new compiler version to break it. Arduino is very conservative about updating to new compiler versions so it will be a long time if ever before that code is broken and even then you would have the option to revert to an older version that was still compatible with your code.

At this stage in your journey I'd advise you to just ignore it and move forward instead of letting this warning halt your progress.

pert:
Not based on the warnings you posted. I can't say whether there was more output you didn't bother to post.

"deprecated conversion from string constant to 'char*'" means this was something that used to be supported and still is but they're planning to stop supporting it in some future compiler version and so they're warning people that it might be a good idea to fix the code now while it still works rather than waiting for the new compiler version to break it. Arduino is very conservative about updating to new compiler versions so it will be a long time if ever before that code is broken and even then you would have the option to revert to an older version that was still compatible with your code.

At this stage in your journey I'd advise you to just ignore it and move forward instead of letting this warning halt your progress.

I would like to thank you so much for your helps. Its so nice to see people around the world like this thanks once more. İt really works what you have suggested me.

You can make the warnings go away. How is stupidly simple, and has been documented many times.

myGLCD.print((char *)"Fark: ",5,40);
Cast the const char * to a char *, which is what the (poorly implemented) function expects.

I say poorly-implemented, because the print() method should NOT be modifying the pointer, and should assure that it wont by making the argument const. But it wasn't properly written, so you have to work around it.

PaulS:
I say poorly-implemented, because the print() method should NOT be modifying the pointer, and should assure that it wont by making the argument const. But it wasn't properly written, so you have to work around it.

It should not be modifying what the pointer is pointing to.

gfvalvo:
It should not be modifying what the pointer is pointing to.

Well, it shouldn't modify where the pointer points, either. So technically, the type should be const char const *.

But, yeah, that's what I meant. I was still waiting for the tea to0 finish brewing.