I’m trying to publish the current epoch time using
Particle.publish(Time.now()); but I keep getting this error `test.cpp:1:1: error: ‘Particle’ does not name a type
make: *** […/build/target/user/platform-6test.o] Error 1
make: *** [user] Error 2`
I don’t know why you get that particular error, but Particle publish takes a String or const char* as the argument (or arguments), not an integer which is what Time.now() returns. Have a look at the docs.
hmm. I have looked on the docs and you are right. https://docs.particle.io/reference/firmware/photon/#now- I’m stuck. What should I do?
If you’re sending data with a Particle publish, you should have two arguments. The first one is the event name, and the second one is the data. You can use sprintf to convert a number to a char*, or you can use String(value) to convert an integer to a String.
char message = "";
sprintf(message, "Time= not sure what to put here ;
I have little (read no) experience with C or C++. I’m still stuck.
Then you need to learn C at least, or there’s no way for you to successfully program your Particle device. We can help with problems that arise, but this forum is not the right place to learn C. You will be continually frustrated if you don’t learn the basics of programming. Do you have experience with any programming language?
Google: sprintf format specifier C++