loading
2Comments

Tell us about yourself!

Complete Your Profile
  • Hi, You need to connect it using AT commands as the library is for the official shield.I will provide you my code. I hope it helps a bit.#include <TembooCoAPEdgeDevice.h>#include <TembooMQTTEdgeDevice.h>#include <SPI.h>#include <WiFi.h>#include <WiFiClient.h>#include <Temboo.h>#include "TembooAccount.h"#include<stdlib.h>#include <SoftwareSerial.h>WiFiClient 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 testingint maxCalls = 1;// The number of times this Choreo has been run so far in this sketchint calls = 0;int inputPin = A0;void setup() { Serial.begin(9600); Serial.println("AT"); delay(500); if(Serial.find("OK"))...see more »Hi, You need to connect it using AT commands as the library is for the official shield.I will provide you my code. I hope it helps a bit.#include <TembooCoAPEdgeDevice.h>#include <TembooMQTTEdgeDevice.h>#include <SPI.h>#include <WiFi.h>#include <WiFiClient.h>#include <Temboo.h>#include "TembooAccount.h"#include<stdlib.h>#include <SoftwareSerial.h>WiFiClient 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 testingint maxCalls = 1;// The number of times this Choreo has been run so far in this sketchint calls = 0;int inputPin = A0;void setup() { Serial.begin(9600); Serial.println("AT"); delay(500); if(Serial.find("OK")){ Serial.println("OK"); connectWiFi(); }}void loop() { int sensorValue = analogRead(inputPin); Serial.println("Sensor: " + String(sensorValue)); if (sensorValue > 500) { 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);}boolean connectWiFi(){ Serial.println("AT+CWMODE=1"); delay(2000); String cmd="AT+CWJAP=\""; cmd+=WIFI_SSID; cmd+="\",\""; cmd+=WPA_PASSWORD; cmd+="\""; Serial.println(cmd); delay(5000); if(Serial.find("OK")){ Serial.println("OK"); return true; }else{ return false; }}void runSendEmail(int sensorValue) { TembooChoreo SendEmailChoreo(client); // Set Temboo account credentials SendEmailChoreo.setAccountName(TEMBOO_ACCOUNT); Serial.println(TEMBOO_ACCOUNT); SendEmailChoreo.setAppKeyName(TEMBOO_APP_KEY_NAME); Serial.println(TEMBOO_APP_KEY_NAME); SendEmailChoreo.setAppKey(TEMBOO_APP_KEY); Serial.println(TEMBOO_APP_KEY); // Set Choreo inputs String FromAddressValue = "agripoffaith1@gmail.com"; Serial.println("agripoffaith1@gmail.com"); SendEmailChoreo.addInput("FromAddress", FromAddressValue); String UsernameValue = "agripoffaith1@gmail.com"; SendEmailChoreo.addInput("Username", UsernameValue); String ToAddressValue = "raghavendran.k@tevatrontech.org"; Serial.println("raghavendran.k@tevatrontech.org"); SendEmailChoreo.addInput("ToAddress", ToAddressValue); String SubjectValue = "LISTEN"; SendEmailChoreo.addInput("Subject", SubjectValue); String PasswordValue = "XYZ"; SendEmailChoreo.addInput("Password", PasswordValue); String MessageBodyValue = "HEYYY"; SendEmailChoreo.addInput("MessageBody", MessageBodyValue); // 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();}

    View Topic »