For future humans reading this who are having this issue but still don't understand why PaulS is saying that Strings aren't strings, here is a more verbose explanation:
Arduino nomenclature uses the word "string" (little s) as a shorthand method of denoting an array of chars. This is distinctly different from the class "String" (big S).
http://www.arduino.cc/en/Reference/String (it really doesn't help that the URL uses big S...)
String() - Arduino Reference
Humans who use phonetic pronunciations to derive meaning (or machines that have the ignoreCase flag set
) might not understand at first that these two things are very different. You can concatenate a String very easily with concat(). You can not do the same operation with a string. Functions that say they want a string input actually want a char array input, and will get very fussy if you try to give them a String.
The main point of confusion (for me, at least) came from the Wire.write() doc page:
It very clearly states that you can send a string using this function. This, however, does NOT mean that you can send a String (believe me, I've tried - you get about a thousand lines of error messages).
So, the solution to this is to convert your String to a string, like so:
Big_S_String.toCharArray(little_s_string, 8);
Wire.write(little_s_string);
I would personally love it if they changed the documentation to say "char array" instead of "string", since it is not intuitively obvious when first starting out down with an Arduino.
As a side note, I'm replying to this year old topic since it was the most relevant to the issue I was facing in hopes that other people who have the same problem and stumble across this thread will understand why their Wire.write() function isn't working. Izak, I hope you've figured all of this out by now. ![]()