ok,
i have an arduino sketch that combine the one wire library, the dallas temperature monitor library and u8graphics library.
i want the oled screen to show the temperature in the kids room
this section of code:
void draw(void) {
// graphic commands to redraw the complete screen should be placed here
u8g.drawStr( 0, 10, "inside");
u8g.drawStr( 0, 28, "outside");
u8g.drawStr( 0, 46, "kids");
u8g.drawStr( 0, 64, "time");
}
works fine, but when i begin to use a variable (that will have the actual temperature)
void draw(void) {
// graphic commands to redraw the complete screen should be placed here
String line1 = "inside";
u8g.drawStr( 0, 10, line1);
u8g.drawStr( 0, 28, "outside");
u8g.drawStr( 0, 46, "kids");
u8g.drawStr( 0, 64, "time");
}
i get the error
Arduino/libraries/U8glib/U8glib.h:201:16: note: no known conversion for argument 3 from 'String' to 'const __FlashStringHelper*'
no matching function for call to 'U8GLIB_SSD1306_128X64::drawStr(int, int, String&)'
what i understand is the "inside" bit i assumed is a String but is in fact a FlashStringHelper? and the two arn't compatible
what i want is to create a string like this
String line1 = string("inside " + printTemperature(localThermometer)));
alrigth i think i was getting confused about the string variable, apparently i should be using char
or calling the u8g.print function when i'm using strings
--
You received this message because you are subscribed to the Google Groups "Robots & Dinosaurs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sydney-hackspa...@googlegroups.com.
To post to this group, send email to sydney-h...@googlegroups.com.
Visit this group at http://groups.google.com/group/sydney-hackspace.
For more options, visit https://groups.google.com/d/optout.
Disclaimer: I last used real C++ about 6 years ago.
I don't see any parameter names, only parameter types.
Matt
thanks!
i ended up using u8g print function, which as you said is the same as serial.print and i already had that working so all was good.
personally, i always find it a bit depressing discovering how much I don't know about something (in this case programming).
it's great acheiving something and i should focus on the the small wins. but yeah, just adding a variable to a string to make a new string i didn't think would take me 2 hours.
also, can someone tell me why this bit of code is legal:
void print(long, int = DEC);
void print(unsigned long, int = DEC);
void print(double, int = 2);
I didn't think you were allowed to use keywords as parameter names.
(also, int = 2 is very disgusting. Arduino Quality Software.)
-A
Also beware of the difference between a string and a String.