# Photon not sending data to the cloud

**URL:** <https://community.particle.io/t/photon-not-sending-data-to-the-cloud/26145>\
**Category:** Troubleshooting\
**Created:** [September 28, 2016, 5:11am UTC](https://community.particle.io/t/photon-not-sending-data-to-the-cloud/26145 "2016-09-28T05:11:40Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![TonyMc](https://avatars.discourse-cdn.com/v4/letter/t/45deac/32.png) [@TonyMc](https://community.particle.io/u/TonyMc)\
**Post date:** [September 28, 2016, 5:11am UTC](https://community.particle.io/t/photon-not-sending-data-to-the-cloud/26145/1 "2016-09-28T05:11:40Z")

</div>

Just got this little board and I’m having trouble with the “sending data to the cloud” portion.  
What does work  
The tinker reads pins  
The build IDE sends to the board  
The scripts run on the board  
I can serial output the data I want  
Particle.publish seems to compile with everything else and the rgb flashes accordingly  
What doesn’t  
The console never receives an event  
The “last connection” info only updates if I reflash the board

Any suggestions on how to troubleshoot this?  
Thanks in advance T

---

<div class="post-metadata">

**Author:** ![Moors7](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/moors7/32/588_2.png) [@Moors7](https://community.particle.io/u/Moors7)\
**Post date:** [September 28, 2016, 6:40am UTC](https://community.particle.io/t/photon-not-sending-data-to-the-cloud/26145/2 "2016-09-28T06:40:28Z")

</div>

Hey there, welcome to the community!

Is the device still breathing cyan?  
Are you adhering to the rate limit as documented?

Mind sharing the code?

---

<div class="post-metadata">

**Author:** ![TonyMc](https://avatars.discourse-cdn.com/v4/letter/t/45deac/32.png) [@TonyMc](https://community.particle.io/u/TonyMc)\
**Post date:** [September 28, 2016, 6:51am UTC](https://community.particle.io/t/photon-not-sending-data-to-the-cloud/26145/3 "2016-09-28T06:51:56Z")

</div>

Thanks Moors  
I’ve been playing with delays. No result  
Here is a 3-4th iteration lol

```cpp
// Define the Pin the Temperature sensor is on
int tempPin = A0;
int led = D7; // The on-board LED

// Create a variable that will store the temperature value
double temperature = 0.0;
double temperatureF = 0.0;

void setup()
{
    Serial.begin(9600);
    pinMode(led, OUTPUT);

    
    }

void loop()
{
    digitalWrite(led, HIGH);
  // Keep reading the sensor value so when we make an API
  // call to read its value, we have the latest one
  int reading = analogRead(tempPin);

  // The returned value from the device is going to be in the range from 0 to 4095
  // Calculate the voltage from the sensor reading
  double voltage = (reading * 3.3) / 4095.0;

  // Calculate the temperature and update our static variable
  temperature = (voltage - 0.5) * 100;

  // Now convert to Farenheight
  temperatureF = ((temperature * 9.0) / 5.0) + 32.0;
  Serial.print(temperature); Serial.println(" degrees C");
  delay(10000);
  Particle.publish("temperature",temperature);
  Particle.variable("temperatureF",temperatureF);
  
  delay(60000);
  digitalWrite(led, LOW); // Turn OFF the LED
  delay(54000);
}

```

Sorry need some speed at copying the code in

---

<div class="post-metadata">

**Author:** ![TonyMc](https://avatars.discourse-cdn.com/v4/letter/t/45deac/32.png) [@TonyMc](https://community.particle.io/u/TonyMc)\
**Post date:** [September 28, 2016, 7:04am UTC](https://community.particle.io/t/photon-not-sending-data-to-the-cloud/26145/4 "2016-09-28T07:04:20Z")

</div>

I get the cyan breath flash constantly only get the cyan blink when I flash to the board. I did get some intermittent “null” data with my first few scripts.  
T

---

<div class="post-metadata">

**Author:** ![ScruffR](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/scruffr/32/6952_2.png) [@ScruffR](https://community.particle.io/u/ScruffR)\
**Post date:** [September 28, 2016, 7:17am UTC](https://community.particle.io/t/photon-not-sending-data-to-the-cloud/26145/5 "2016-09-28T07:17:01Z")

</div>

> [@TonyMc](#):
>
> Particle.variable("temperatureF",temperatureF);

This does not go into `loop()` but in `setup()`.

How do you try to view your events?

Your delays won't need to be that long. As long you don't publish more than once every 1010 milliseconds (I know it's supposed to be 1000, but in older versions there was a bug).

---

<div class="post-metadata">

**Author:** ![TonyMc](https://avatars.discourse-cdn.com/v4/letter/t/45deac/32.png) [@TonyMc](https://community.particle.io/u/TonyMc)\
**Post date:** [September 28, 2016, 7:37am UTC](https://community.particle.io/t/photon-not-sending-data-to-the-cloud/26145/6 "2016-09-28T07:37:25Z")

</div>

That variable line is just thrown in to see if it will send as opposed to a publish line.  
The delay times have just been sent out to 1min as there is no need for anything quicker.  
I have just been using a an arduino serial monitor to get the serial data and the console to check for uploads( ardiuno works ok).  
Ta  
T 24h on photon lol

---

<div class="post-metadata">

**Author:** ![ScruffR](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/scruffr/32/6952_2.png) [@ScruffR](https://community.particle.io/u/ScruffR)\
**Post date:** [September 28, 2016, 7:40am UTC](https://community.particle.io/t/photon-not-sending-data-to-the-cloud/26145/7 "2016-09-28T07:40:39Z")

</div>

If your device is breathing cyan, I’d not see a reason why the events don’t show up in  
[https://console.particle.io/logs](https://console.particle.io/logs)

But for testing it’s usually good to have shorter delays to allow for shorter test cycles 😉  
And about `Particle.variable()`, still move it to `setup()`, how it’s supposed to be used.

---

<div class="post-metadata">

**Author:** ![chrisb2](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/chrisb2/32/20743_2.png) [@chrisb2](https://community.particle.io/u/chrisb2)\
**Post date:** [September 28, 2016, 7:45am UTC](https://community.particle.io/t/photon-not-sending-data-to-the-cloud/26145/8 "2016-09-28T07:45:47Z")

</div>

[Particle publish](https://docs.particle.io/reference/firmware/photon/#particle-publish-) does not support the double data type only char, you need something like:

```
char eventData[5];
sprintf(eventData, "%.1f", temperature);
Particle.publish("temperature", eventData, 60, PRIVATE);

```

---

<div class="post-metadata">

**Author:** ![TonyMc](https://avatars.discourse-cdn.com/v4/letter/t/45deac/32.png) [@TonyMc](https://community.particle.io/u/TonyMc)\
**Post date:** [September 28, 2016, 8:18am UTC](https://community.particle.io/t/photon-not-sending-data-to-the-cloud/26145/9 "2016-09-28T08:18:41Z")

</div>

thanks for the help everyone. Need to do some cooking. heres one of my other attemts that gave the same

```auto
//TMP36 Pin Variables
int sensorPin = A0; //the analog pin the TMP36's Vout (sense) pin is connected to
                      //the resolution is 10 mV / degree centigrade with a
                        //500 mV offset to allow for negative temperatures
 
/*
 * setup() - this function runs once when you turn your Arduino on
 * We initialize the serial connection with the computer
 */
void setup()
{
  Serial.begin(9600); //Start the serial connection with the computer
int TempSensor; //to view the result open the serial monitor 
}
 
void loop() // run over and over again
{
 //getting the voltage reading from the temperature sensor
 int reading = analogRead(sensorPin);  
 Particle.publish("temperature", sensorPin);
 delay(1000);
 // converting that reading to voltage, for 3.3v arduino use 3.3
 float voltage = reading * 3.3;
 voltage /= 4095.0; 
 
 // print out the voltage
 Serial.print(voltage); Serial.println(" volts");
 
 // now print out the temperature
 float temperatureC = (voltage - 0.5) * 100 ; //converting from 10 mv per degree wit 500 mV offset
                                               //to degrees ((voltage - 500mV) times 100)
 Serial.print(temperatureC); Serial.println(" degrees C");
 Particle.publish("temperatureC ",temperatureC);
 
 // now convert to Fahrenheit
 float temperatureF = (temperatureC * 9.0 / 5.0) + 32.0;
 Serial.print(temperatureF); Serial.println(" degrees F");
 
 
 
 delay(60000); //waiting a second
}

```

if anyone has a few minutes can they see the common problem?

---

<div class="post-metadata">

**Author:** ![ScruffR](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/scruffr/32/6952_2.png) [@ScruffR](https://community.particle.io/u/ScruffR)\
**Post date:** [September 28, 2016, 12:31pm UTC](https://community.particle.io/t/photon-not-sending-data-to-the-cloud/26145/10 "2016-09-28T12:31:16Z")

</div>

Doh’, completely missed that 😊  
I was so focused on the `Particle.variable()` that I missed the `Particle.publish()` issue.

But I’m stunned that this even built 😕  
Obviously there is an overload that is not type safe  
I’d suspect these two

```cpp
Particle.publish(const char *eventName, PRIVATE);
Particle.publish(String eventName, PRIVATE);

```

@mdma?

* * *

And @TonyMc, when you provide a new version of your code, it would be nice to see that you’ve at least incorporated the hints you got so far.  
There is also no overload of `Particle.publish()` that would publish an `int` (which is the type of `sensorPin`) or `float` (which is the type of `temperatureC`).  
Try @chrisb2’s suggestion!
