int calibrationTime = 10;
int outputpin= 0;
//the time when the sensor outputs a low impulse
long unsigned int lowIn;
//the amount of milliseconds the sensor has to be low
//before we assume all motion has stopped
long unsigned int pause = 5000;
boolean lockLow = true;
boolean takeLowTime;
int pirPin = 3; //the digital pin connected to the PIR sensor's output
int ledPin = 13;
int calls = 1;
int maxCalls = 10;
#include <Bridge.h>
#include <Temboo.h>
#include "TembooAccount.h" // contains Temboo account information
/*** SUBSTITUTE YOUR VALUES BELOW: ***/
// Note that for additional security and reusability, you could
// use #define statements to specify these values in a .h file.
// your Gmail username, formatted as a complete email address, eg "bob.smith@gmail.com"
const String GMAIL_USER_NAME = "csalerter@gmail.com";
// your Gmail App-Specific Password
const String GMAIL_PASSWORD = "CsAlerters2017";
// the email address you want to send the email to, eg "jane.doe@temboo.com"
const String TO_EMAIL_ADDRESS = "sreyayadlapalli28@gmail.com";
boolean success = false; // a flag to indicate whether we've sent the email yet or not
/////////////////////////////
//SETUP
void setup(){
Serial.begin(9600);
pinMode(pirPin, INPUT);
pinMode(ledPin, OUTPUT);
digitalWrite(pirPin, LOW);
delay(4000);
while(!Serial);
Bridge.begin();
//give the sensor some time to calibrate
Serial.print("calibrating sensor ");
for(int i = 0; i < calibrationTime; i++){
Serial.print(".");
delay(1000);
}
Serial.println(" done");
Serial.println("SENSOR ACTIVE");
delay(50);
}
////////////////////////////
//LOOP
void loop(){
if(digitalRead(pirPin) == HIGH){
digitalWrite(ledPin, HIGH); //the led visualizes the sensors output pin state
if(lockLow){
//makes sure we wait for a transition to LOW before any further output is made:
lockLow = false;
delay(50);
}
takeLowTime = true;
}
if(digitalRead(pirPin) == LOW){
digitalWrite(ledPin, LOW); //the led visualizes the sensors output pin state
if(takeLowTime){
lowIn = millis(); //save the time of the transition from high to LOW
takeLowTime = false; //make sure this is only done at the start of a LOW phase
}
//if the sensor is low for more than the given pause,
//we assume that no more motion is going to happen
if(!lockLow && millis() - lowIn > pause){
//makes sure this block of code is only executed again after
//a new motion sequence has been detected
lockLow = true;
delay(50);
}
}
int rawvoltage= analogRead(outputpin);
float millivolts= (rawvoltage/1024.0) * 5000;
float fahrenheit= millivolts/10;
Serial.print(fahrenheit);
Serial.println(" degrees Fahrenheit, ");
delay(1000);
if(((fahrenheit > 75) || (fahrenheit < 30)) &&(digitalRead(pirPin) == HIGH)){
Serial.println("YOUR CHILD IS IN DANGEROUS TEMPERATURES!!!");
// only try to send the email if we haven't already sent it successfully
if (!success) {
if (calls <= maxCalls) {
Serial.println("Running SendEmail - Run #" + String(calls++));
TembooYunShieldChoreo SendEmailChoreo;
// Invoke the Temboo client
SendEmailChoreo.begin();
// Set Temboo account credentials
SendEmailChoreo.setAccountName(TEMBOO_ACCOUNT);
SendEmailChoreo.setAppKeyName(TEMBOO_APP_KEY_NAME);
SendEmailChoreo.setAppKey(TEMBOO_APP_KEY);
SendEmailChoreo.setDeviceType(TEMBOO_DEVICE_TYPE);
// Set Choreo inputs
SendEmailChoreo.addInput("FromAddress", "csalerter@gmail.com");
SendEmailChoreo.addInput("Username", "csalerter@gmail.com");
SendEmailChoreo.addInput("Subject", "hi");
SendEmailChoreo.addInput("ToAddress", "sreyayadlapalli28@gmail.com");
SendEmailChoreo.addInput("Password", "uzdxadujhxlwwylp");
SendEmailChoreo.addInput("MessageBody", "hi");
// Identify the Choreo to run
SendEmailChoreo.setChoreo("/Library/Google/Gmail/SendEmail");
// Run the Choreo; when results are available, print them to serial
SendEmailChoreo.run();
while(SendEmailChoreo.available()) {
char c = SendEmailChoreo.read();
Serial.print(c);
}
SendEmailChoreo.close();
}
Serial.println("Waiting...");
delay(30000); // wait 30 seconds between SendEmail calls
}
// do nothing for the next 60 seconds
delay(60000);
}
}
else{
Serial.println("Your child is safe.");
}
delay(5000);
}
Tried troubleshooting the error we were getting and were not able to find out the issue.
It says "Arduino: 1.8.2 (Mac OS X), Board: "Arduino/Genuino Uno"
/Users/saideepakyerra/Documents/Arduino/ecyb/ecyb.ino: In function 'void loop()':
ecyb:109: error: 'TembooYunShieldChoreo' was not declared in this scope
TembooYunShieldChoreo SendEmailChoreo;
^
ecyb:112: error: 'SendEmailChoreo' was not declared in this scope
SendEmailChoreo.begin();
^
/Users/saideepakyerra/Documents/Arduino/ecyb/ecyb.ino: At global scope:
ecyb:148: error: expected unqualified-id before 'else'
else{
^
ecyb:151: error: expected constructor, destructor, or type conversion before '(' token
delay(5000);
^
ecyb:153: error: expected declaration before '}' token
}
^
exit status 1
'TembooYunShieldChoreo' was not declared in this scope
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
"