0
votes

I'm using a Dragino Yun Shield with my Arduino Uno and a reed sensor. The response to the code below indicates no errors, but yet the data on Parse.com does not show that it is updated. What am I doing wrong? The Bridge wifi test says it's connected just fine.

void loop() {
  currentState = digitalRead(7);
  if(currentState != prevState){
    prevState = currentState;
    Console.println("Pushing to parse!");
    ParseObjectUpdate update;
    update.setClassName("DoorState");
    update.setObjectId("##########");
    bool isOpen = currentState == HIGH;
    update.add("isOpen", isOpen);
    ParseResponse response = update.send();
    if (!response.getErrorCode()) {
        Console.println("Object saved success!");
    } else {
        Console.println("Error");
        int err = response.getErrorCode();
        Console.println(err);
    }
    response.close();
    Console.print("Pushed: "); Console.println(isOpen);
  }
}
1
Why bool isOpen = currentState == HIGH; ? You always send isOpen as HIGH. How do you expect to update it?jabujavi
If currentState is HIGH, that means the door is open. I am using comparison operator ==, not the assignment operator =. At the end of my code it says pushed 0 or 1 correctly. It just never shows up in Parse.Toni_Entranced
OH! Sorry... I was searching for arduino problems. For readability, you could change it to bool isOpen = (currentState == HIGH); Last weekend I start some project for fun in Parse... I would like to help you in some time. Luck!jabujavi

1 Answers

0
votes

Copied from a similar thread that I answered (Arduino yun to parse.com):

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!