-
-
Notifications
You must be signed in to change notification settings - Fork 116
error: 'Parse' was not declared in this scope #73
Description
Hello i am getting error: 'Parse' was not declared in this scope
following is my code :
include <ArduinoJson.h> //Libray for JSON parsing
include <Parse.h> //Parse Library
include <Bridge.h>
include <Process.h>
char mac_id[] = "B4:21:8A:F0:00:AE"; //MAC ID of Arduino Device
char char_installationId[] = ""; //MAC ID of Arduino Device
static int counter =0; //Counter to call setup function after sometime.
int push_button = 3; //Push Button is used to book room
int button_counter = 0; //this is used to toggle room book/cancel
boolean isButtonPressed = false;
/***************************************************************************************************************************
setup function
-
This function is used to make authentication with Parse cloud.It gets the installation id for
push notification.The entry of MAC id is also stored in Parse Cloud if it is not registered before.
****************************************************************************************************************************/
void setup() {Bridge.begin();
Serial.begin(9600);
// attachInterrupt(digitalRead(2),checkButtonStatus,HIGH);pinMode(push_button,INPUT); // push button analog sensor pin => 1
pinMode(0,INPUT); //light sensor pin analog pin => 0Serial.println("In Setup ");
while (!Serial);
connect_to_Parse(); insertMacDetails_parse();
}//setup function block
/***************************************************************************************************************************
checkButtonStatus function
-This function will detect whether button is pressed or not
**************************************************************************************************************************/
void checkButtonStatus()
{
Serial.print("Pressed button");
isButtonPressed = true;
}
/***************************************************************************************************************************
connect_to_Parse function
- This function will connect to Parse application using Application ID and Client key
**************************************************************************************************************************/
void connect_to_Parse()
{
Serial.println("Connect to parse");
//CONNECT TO PARSE CLOUD
// Initialize Parse
Parse.begin("NR9dHycpjgUn0Bcem3lH1q0jniHSiynGh5yKe4Ws", "lC066NvhZDCfucTVB5yfaJCOyE2LhClq3T1OcxF6");
// In this example, we associate this device with a pre-generated installation
Parse.getInstallationId();
Parse.startPushService();
String installationId = Parse.getInstallationId();
installationId.toCharArray(char_installationId,40);
}
void insertMacDetails_parse()
{
Serial.println("Insert mac details ");
if(counter == 0)
{
ParseCloudFunction cloudFunction;
cloudFunction.setFunctionName("InsertArduinoMacID");
cloudFunction.add("mac_id", mac_id);
ParseResponse response = cloudFunction.send();
ParseCloudFunction cloudfn;
cloudfn.setFunctionName("insertMacinInstallation");
cloudfn.add("mac_id", mac_id);
cloudfn.add("char_installationId",char_installationId);
ParseResponse response1 = cloudfn.send();
}//if counter==0 block
}//insertMacDetails_parse function block
/***************************************************************************************************************************
loop function
- This function continuosly gets executed.In this we send continuos sensor data to cloud and we
also check for Push notifications from Parse.
****************************************************************************************************************************/
void loop() {
//attachInterrupt(digitalRead(2),checkButtonStatus,HIGH);
counter++;
Serial.println("In loop ");
// Serial.println(counter);
checkPush_parse(); //check whether there is any Push notification or not
// push_button_book_parse(); //Book or cancel room reservation
send_sensorData_parse(); //send Sensor data to parse
if(counter % 10 == 0){
setup();
}//CALL SETUP AFTER SOME TIME.THIS SOLVED PUSH AND CONTINUOS CLOUD CODE CALL ISSUE.
if(isButtonPressed == true)
{
push_button_book_parse();
}
} //loop function block
/***************************************************************************************************************************
checkPush_parse function
-
This function will check whether Arduino has any push notification or not
If message is ON LED will be turned ON
If message is OFF LED will be turned OFF.
****************************************************************************************************************************/
void checkPush_parse()
{if (Parse.pushAvailable()) {
Serial.println("Got push"); ParsePush push = Parse.nextPush(); String message = push.getJSONBody(); Serial.println(message); //Print Push message Serial.println("After Message"); // IMPORTANT, close your push message push.close();
checkStatus(message); //CHECK THE PUSH MESSAGE CONTENT
// setup(); // CALL SETUP FUNCTION}//if push notification block
}//checkPush_parse function block
can someone help for this? Thanks