Sending An Sms With Temboo
Sending An Sms With Temboo
Guide Contents 2
Overview 3
Get Set Up 4
Generate Your Sketch 11
Upload and Run 15
Push to Send 17
Wiring Your Circuit 18
Adding Code 19
An Arduino Uno R3
You'll also need a Temboo account and a Twilio account. To set up your Temboo account (if
you don't already have one) you can create one for free here (http://adafru.it/e53). You can
create a free Twilio account here (http://adafru.it/e54).
Finally, make sure that you have the latest version of Temboo's Arduino library installed; if
you don't, you can download it here (http://adafru.it/e55).
Next, fill out the Input fields using the information from your Twilio account, the text of the
SMS that you want to send, and the phone number to which you would like to send it. You'll
find your Twilio Account SID and Auth Token by going to Twilio (http://adafru.it/e54) and
checking your Dashboard, as shown below; note that you need to use the credentials found
on the Dashboard, not the test credentials from the Twilio Dev Tools panel:
When using a free Twilio account, you'll need to verify the phone numbers to which
messages are being sent by going to Twilio and following the instructions under
the Numbers > Verified Caller IDs tab, as shown below.
In order to run this sketch on your Arduino, it needs to be configured with an appropriate
TembooAccount.h header file that contains your Temboo account information and internet
shield setup information. To create the header file, make a new tab in the Arduino IDE, and
name it TembooAccount.h.
On the Twilio SendSMS Choreo page beneath the sketch code that you previously copied
and pasted into the Arduino IDE, you’ll find another block of generated code containing
#define statements and details about your internet shield. This is your header file. Copy the
contents of the header into the TembooAccount.h tab in your Arduino IDE.
When the button in this circuit is pressed, pin 8 will be connected to power, and will read
HIGH. When the button is left open, pin 8 is connected to ground, and will read LOW.
// Initialize pin
pinMode(8, INPUT);
void setup() {
Serial.begin(9600);
// Initialize pin
pinMode(8, INPUT);
Serial.println("Setup complete.\n");
}
Then, add the following two lines of code to void loop() to set the SendSMS Choreo to run
only when the button is pressed:
You should nest the code that you already have in void loop() within this new conditional, so
that it should now look something like this:
void loop() {
int sensorValue = digitalRead(8);
if (sensorValue == HIGH) {
if (numRuns <= maxRuns) {
Serial.println("Running SendSMS - Run #" + String(numRuns++));
TembooChoreo SendSMSChoreo(client);
// Run the Choreo; when results are available, print them to serial
SendSMSChoreo.run();
while(SendSMSChoreo.available()) {
char c = SendSMSChoreo.read();
Serial.print(c);
}
Serial.println("\nWaiting...\n");
delay(30000); // wait 30 seconds between SendSMS calls
}
}
Don't forget to add a curly bracket at the end of void loop() to close out the
additional conditional! Note that in the code example above, the Choreo inputs have been
replaced with placeholders. The code that you generate on the Temboo website will
automatically have these input values filled in, so there's no need to worry about replacing
them manually.
With that, your sketch is once again ready to go—you're free to tinker with it as you wish (for
example, you might choose to comment out the 30 second delay at the end if you want to
send messages more rapidly), but no further alterations are required. Save it, upload it to
your Arduino, open the serial monitor, and push the button to dispatch your SMS!