Sorry, I'm brand new to this, but trying a lot of things and still having some trouble!
MY HARDWARE:
• Arduino Uno
• WiFi 101 ShieldIf
• Ultrasonic Sensor
I WANT TO DO THIS:
When the ultrasonic sensor detects the object at a distance of (x) centimeters, send an email to (y) email address.
ALREADY DONE:
I set up the Google App-Specific Password, Username, FromAddress, Message Body, etc. on Temboo
The sensor event is as follows: If Digital 8 is HIGH then run the Choreo
QUESTIONS:
• How can I set the exact distance that triggers the Choreo?
• What do I do with the "Header" file, where does that go?
• When I paste the code and attempt to verify, I get the following Error Message. How do I fix this?:
Users/stucarnes/Documents/Arduino/TEMBOO___Tank/TEMBOO___Tank.ino:5:66: fatal error: TembooAccount.h: No such file or directory
#include "TembooAccount.h" // Contains Temboo account information
- ^*
compilation terminated.
Multiple libraries were found for "Temboo.h"
Used: /Users/stucarnes/Documents/Arduino/libraries/Temboo
Not used: /Applications/Arduino.app/Contents/Java/libraries/Temboo
exit status 1
Error compiling for board Arduino/Genuino Uno.
–––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
Below is the code that all of the above is referring to, that Temboo generated:
#include <SPI.h>
#include <WiFi.h>
#include <WiFiClient.h>
#include <Temboo.h>
#include "TembooAccount.h" // Contains Temboo account informationWiFiClient client;
// The number of times to trigger the action if the condition is met
// We limit this so you won't use all of your Temboo calls while testing
int maxCalls = 10;// The number of times this Choreo has been run so far in this sketch
int calls = 0;int inputPin = 8;
void setup() {
Serial.begin(9600);// For debugging, wait until the serial console is connected
delay(4000);
while(!Serial);int wifiStatus = WL_IDLE_STATUS;
// Determine if the WiFi Shield is present
Serial.print("\n\nShield:");
if (WiFi.status() == WL_NO_SHIELD) {
Serial.println("FAIL");// If there's no WiFi shield, stop here
while(true);
}Serial.println("OK");
// Try to connect to the local WiFi network
while(wifiStatus != WL_CONNECTED) {
Serial.print("WiFi:");
wifiStatus = WiFi.begin(WIFI_SSID);
if (wifiStatus == WL_CONNECTED) {
Serial.println("OK");
} else {
Serial.println("FAIL");
}
delay(5000);
}// Initialize pins
pinMode(inputPin, INPUT);Serial.println("Setup complete.\n");
}void loop() {
int sensorValue = digitalRead(inputPin);
Serial.println("Sensor: " + String(sensorValue));if (sensorValue == HIGH) {
if (calls < maxCalls) {
Serial.println("\nTriggered! Calling SendEmail Choreo...");
runSendEmail(sensorValue);
calls++;
} else {
Serial.println("\nTriggered! Skipping to save Temboo calls. Adjust maxCalls as required.");
}
}
delay(250);
}void runSendEmail(int sensorValue) {
TembooChoreo SendEmailChoreo(client);// Set Temboo account credentials
SendEmailChoreo.setAccountName(TEMBOO_ACCOUNT);
SendEmailChoreo.setAppKeyName(TEMBOO_APP_KEY_NAME);
SendEmailChoreo.setAppKey(TEMBOO_APP_KEY);// Set Choreo inputs
String FromAddressValue = "xxxxxxx@gmail.com";
SendEmailChoreo.addInput("FromAddress", FromAddressValue);
String UsernameValue = "xxxxxxx@gmail.com";
SendEmailChoreo.addInput("Username", UsernameValue);
String ToAddressValue = "xxxxxxx@gmail.com";
SendEmailChoreo.addInput("ToAddress", ToAddressValue);
String SubjectValue = "Hello";
SendEmailChoreo.addInput("Subject", SubjectValue);
String MessageBodyValue = "xxxxxxx";
SendEmailChoreo.addInput("MessageBody", MessageBodyValue);
String PasswordValue = "xxxxxxxxxxx";
SendEmailChoreo.addInput("Password", PasswordValue);// Identify the Choreo to run
SendEmailChoreo.setChoreo("/Library/Google/Gmail/SendEmail");// Run the Choreo
unsigned int returnCode = SendEmailChoreo.run();// Read and print the error message
while (SendEmailChoreo.available()) {
char c = SendEmailChoreo.read();
Serial.print(c);
}
Serial.println();
SendEmailChoreo.close();
}
COPY
HEADER FILE