Hello,
Problem:
I am trying to integrate Temboo with the Arduino Yun Rev 2. I know that Temboo supports integration with the original Yun but I'm not sure about the upgraded Yun. I have pasted the SendSMS example sketch below ( File -> Examples -> Temboo -> Arduino Yun -> SendSMS). I have already created my Temboo & Twilio account and have verified that Twilio is able to send SMS to my iPhone.
Question(s):
- Does anyone know if Temboo can be used on the Yun Rev 2?
- The original Yun has been retired for several years now, does anyone know where to purchase one? (I've tried Amazon and few other sites but no luck).
Code: (SendSMS file and Temboo.h file)
/*
SendAnSMS
This example code is in the public domain.
*/
#include <Bridge.h>
#include <Temboo.h>
#include "TembooAccount.h" // contains Temboo account information
// as described in the footer comment below
// the Account SID from your Twilio account
const String TWILIO_ACCOUNT_SID = "XXXX";
// the Auth Token from your Twilio account
const String TWILIO_AUTH_TOKEN = "XXXX";
// your Twilio phone number, e.g., "+1 555-222-1212"
const String TWILIO_NUMBER = "XXXXXXX";
// the number to which the SMS should be sent, e.g., "+1 555-222-1212"
const String RECIPIENT_NUMBER = "XXXXXX";
// a flag to indicate whether we've attempted to send the SMS yet or not
boolean attempted = false;
void setup() {
Serial.begin(9600);
// for debugging, wait until a serial console is connected
delay(4000);
while(!Serial);
Bridge.begin();
}
void loop()
{
// only try to send the SMS if we haven't already sent it successfully
if (!attempted) {
Serial.println("Running SendAnSMS...");
// we need a Process object to send a Choreo request to Temboo
TembooChoreo SendSMSChoreo;
// invoke the Temboo client
// NOTE that the client must be reinvoked and repopulated with
// appropriate arguments each time its run() method is called.
SendSMSChoreo.begin();
// set Temboo account credentials
SendSMSChoreo.setAccountName(TEMBOO_ACCOUNT);
SendSMSChoreo.setAppKeyName(TEMBOO_APP_KEY_NAME);
SendSMSChoreo.setAppKey(TEMBOO_APP_KEY);
// identify the Temboo Library choreo to run (Twilio > SMSMessages > SendSMS)
SendSMSChoreo.setChoreo("/Library/Twilio/SMSMessages/SendSMS");
// set the required choreo inputs
// see Library - Twilio - SMSMessages - SendSMS API :: Temboo
// for complete details about the inputs for this Choreo
// the first input is a your AccountSID
SendSMSChoreo.addInput("AccountSID", TWILIO_ACCOUNT_SID);
// next is your Auth Token
SendSMSChoreo.addInput("AuthToken", TWILIO_AUTH_TOKEN);
// next is your Twilio phone number
SendSMSChoreo.addInput("From", TWILIO_NUMBER);
// next, what number to send the SMS to
SendSMSChoreo.addInput("To", RECIPIENT_NUMBER);
// finally, the text of the message to send
SendSMSChoreo.addInput("Body", "Hey, there! This is a message from your Arduino Yun!");
// tell the Process to run and wait for the results. The
// return code (returnCode) will tell us whether the Temboo client
// was able to send our request to the Temboo servers
unsigned int returnCode = SendSMSChoreo.run();
// a return code of zero (0) means everything worked
if (returnCode == 0) {
Serial.println("Success! SMS sent!");
} else {
// a non-zero return code means there was an error
// read and print the error message
while (SendSMSChoreo.available()) {
char c = SendSMSChoreo.read();
Serial.print(c);
}
}
SendSMSChoreo.close();
// set the flag indicatine we've tried once.
attempted=true;
}
}
/*
TembooAccount.h:
#define TEMBOO_ACCOUNT "myTembooAccountName" // your Temboo account name
#define TEMBOO_APP_KEY_NAME "myFirstApp" // your Temboo app key name
#define TEMBOO_APP_KEY "xxx-xxx-xxx-xx-xxx" // your Temboo app key
*/