I agree with Paul: Forget about the String class; it uses too much memory relative to the C string (note lower case ‘s’) data type which is built from character arrays. Load and run the following program:
void setup() {
int i;
Serial.begin(9600);
for (i = 128; i < 256; i++) {
Serial.print(i);
Serial.print(" ");
Serial.println((char) i);
}
}
void loop() {
}
which displays the extended character set for the Arduino. It looks like character 186 is the degree mark. Also take a look at itoa() function.
econjack:
I agree with Paul: Forget about the String class; it uses too much memory relative to the C string (note lower case ‘s’) data type which is built from character arrays. Load and run the following program:
void setup() {
int i;
Serial.begin(9600);
for (i = 128; i < 256; i++) {
Serial.print(i);
Serial.print(" ");
Serial.println((char) i);
}
}
void loop() {
}
which displays the extended character set for the Arduino. It looks like character 186 is the degree mark. Also take a look at *itoa()* function.
I’ve tried this program, and many characters in the output show as an empty rectangle. Something must be wrong with the font, I presume. What can be done about it?
No. Many characters are unprintable. How do you print an end-of-file character? What representation should you use to show that?
The A-hat problem is due to the way that the Arduino IDE saves the files as unicode. If you type the degree character and upload to the Arduino before saving, you will get a different result to when you open that saved file and upload it.
const char DEGREE_SYMBOL = 167; //167 is the ASCII code for the degree symbol (may not work on unicode systems.)
...
Serial.write(DEGREE_SYMBOL);
No. I am asking why bother sending degree signs to SD. The variety of answers may all be correct, they may all be wrong. They may also reflect the relevance.
ArduinoStarter1:
It seems that instructions for presentation to the serial monitor, LCD and saving to SD-card don't be the same.
The style of sending the instructions is essentially the same. the detail is unsurprisingly different for a special character. I believe a degree sign is built into the limited character set of a typical character LCD library, while in a graphic one you probably always have to make your own.
While I think sending deg signs to CSV is pretty pointless. I think