aclendenen
aclendenen

Reputation: 3

Arduino yun to parse.com

I am trying to post an object to my parse.com app from my arduino yun and it needs to post a new object every second. So far I have been able to post every 10 seconds but I cannot seem to get the arduino to post any faster than that. I tried looking into the parse library but don't see what would be slowing it down. I am using the parse library given in the guide at https://www.parse.com/docs/arduino/guide.

here is the code I have so far.

#include <Parse.h>
#include <Bridge.h>
#include <arduino.h>

ParseObjectCreate create;

void setup() {
 Serial.begin(9600); 
 parseInit();
}

void loop() {
  parseFunc(24); // just send 24 everytime for testing
}

void parseInit()
{  
  Bridge.begin();
  while (!Serial); // wait for a serial connection

  Parse.begin("**********", "***********"); //my parse keys
  create.setClassName("Temperature");
}

void parseFunc(float tempC)
{
  create.add("temperature", tempC);
  ParseResponse response = create.send();
  response.close();
}

Upvotes: 0

Views: 112

Answers (1)

John Davis
John Davis

Reputation: 223

You are probably being rate limited by Parse. The code executed in loop() is executed as quickly as the micro controller can execute it - which is very fast. As a result, you are trying to write to Parse many many more times than once a second. Try putting a call to delay() after parseFunc(24). Something like:

parseFunc(24); delay(1000); //delay is in milliseconds

Let me know if it works!

Upvotes: 1

Related Questions