I must be missing something very basic here ?
Using Particle Build, whenever I try and declare a String it does not “highlight” the word String ? Or string ?
And I get an error when I verify.
I can declare integers just fine, int is highlighted, but not Int - which is fine no caps
Also I can declare char just fine, char is automatically highlighted
Looking at Strings in Particle Reference docs: It looks just like Arduino IDE, which works fine.
String, with a capital “S” should work, but it does not get highlighted, even though it shows it blue in the docs. Are you trying this in a .ino file? If not, then you should include “application.h” at the top of your file. What error are you getting?
What hardware (Core or Photon) and what firmware version are you targeting?
Serial.print(myString) should always work, but with a current version Serial.write(myString) should work too - alternatively you could try Serial.write((const char*)myString) or Serial.write(myString.c_str()) too.
Hi - I’m having a similar problem. Can’t seem to declare String, IDE does not turn the writing blue. And particle.publish() using my sting will not send back an event.
In the IDE String is not being declared / highlighted Blue. Code just take a push of a button into Pin3. Logic turns off LED on Pin7. When button is released some data will be published, num times pressed, how long.
As an aside I’m also trying to publish lots of data in one event. Particle.publish() only seems to handle Stings. Welcome any advice on publishing arrays of data.
the fact that it's not lighting up blue doesn't mean it's not working. It's just that the syntax highlighting of the Web IDE shows it as being something 'special'.
But other than that, I'm not quite seeing how you determine how it's not working? If it compiles and flashes, it ought to work, save for logical errors.
What doe you expect it to do, and what doesn't it do? And what does it do?