Can't connect to Ubidots from a Photon :-(


#1

I’m using the SendValuesTCP example in the Ubidots library that supports the Photon. I changed my TOKEN and then ran that example, but it is failing. Any ideas? Is there some TCP port that needs to be open that my university might be blocking?

Does it matter that I a have an account on the educational rather than industrial Ubidots site?

For the record, my code is here:

// This example sends data to multiple variables to 
// Ubidots through TCP protocol.

/****************************************
 * Include Libraries
 ****************************************/

#include "Ubidots.h"

/****************************************
 * Define Instances and Constants
 ****************************************/

#ifndef UBIDOTS_TOKEN
#define UBIDOTS_TOKEN "MY_TOKEN_WAS_HERE"  // Put here your Ubidots TOKEN
#endif

Ubidots ubidots(UBIDOTS_TOKEN, UBI_TCP);


/****************************************
 * Auxiliar Functions
 ****************************************/

//Put here your auxiliar functions


/****************************************
 * Main Functions
 ****************************************/

void setup() {
  Serial.begin(115200);
  //ubidots.setDebug(true);  // Uncomment this line for printing debug messages
}

void loop() {
  float value1 = 10.0f;

  ubidots.add("Variable_Name_One", value1);  // Change for your variable name

  bool bufferSent = false;
  bufferSent = ubidots.send();  // Will send data to a device label that matches the device Id

  if(bufferSent){
    // Do something if values were sent properly
    Serial.println("Values sent by the device");
  } else {
    Serial.println("Something has gone wrong :-(");
  }

  delay(5000);
}

#2

Greetings, can you post the serial port output to further debug? Are you using an educational or an Industrial account? Your photon should be able to connect to industrial.api.ubidots.comor things.ubidots.com through the port 80 based on your account type.

All the best