I have code that compiles when logged in as one user in the web IDE but the same code will not compile when logged in as another user in the web IDE. The problem appears to be with Particle.publish(). The line in question reads:
Particle.publish(“telemetry”, pq.buffer, NO_ACK);
The code compiles as written when logged in as one user. However, when logged in as another user, the same code gives the error message:
‘NO_ACK’ was not declared within this scope.
For this second user, if I edit the line eliminating the NO_ACK parameter, so that it reads
the code compiles.
Why would identical code compile differently for different users?
My guess is it’s because one of the user’s default target device is an Electron, and one is not. The NO_ACK flag is only available on the Electron, so if you build for a Photon or Core, you’ll get a not declared within this scope error.
The device ID is a 24-character long hexadecimal string, but it’s not printed on the package anywhere, as it’s intended to be kept relatively secret. It’s different from the SIM card ICCID.
If you have already configured your device and claimed it to your account, you can use https://build.particle.io, select the Device tab (the circle with the lines, the target icon), then select the device. It will list the device ID.
If you have not set up your device yet, the easiest way to deal with the device ID is to use the Particle CLI, Command Line Interface. It will be useful later on as you use your Photon or Electron, so it’s worth taking the time to set it up.
If you are using Windows, I recommend using the new Windows CLI installer:
Once you’ve installed the CLI, connect the device by USB to your computer and put the device in Listening Mode if it’s not already blinking blue. Hold down the SETUP button (MODE for Electron) until the status LED blinks blue.