The Temboo service has moved away from Arduino support. The service access in this older guide will no longer work.

You've already generated all of the code you need to send an SMS through Twilio using your Arduino, so you only need to add a couple of extra lines to your sketch to trigger those messages with your push button. First, initialize the pin that you will be reading (recall that we chose to use pin 8) by adding the following lines of code to what you already have in void setup():

// Initialize pin
pinMode(8, INPUT);

Your setup should now look something like this:

void setup() {
  // For debugging, wait until the serial console is connected.

  status_t wifiStatus = STATUS_DISCONNECTED;
  while (wifiStatus != STATUS_CONNECTED) {
    if (cc3k.begin()) {
      if (cc3k.connectToAP(WIFI_SSID, WPA_PASSWORD, WLAN_SEC_WPA2)) {
        wifiStatus = cc3k.getStatus();
    if (wifiStatus == STATUS_CONNECTED) {
    } else {
  // 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:

int sensorValue = digitalRead(8);
if (sensorValue == HIGH) {

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);

      // Invoke the Temboo client

      // Set Temboo account credentials

      // Set Choreo inputs
      String AuthTokenValue = "PLACEHOLDER";
      SendSMSChoreo.addInput("AuthToken", AuthTokenValue);
      String BodyValue = "PLACEHOLDER";
      SendSMSChoreo.addInput("Body", BodyValue);
      String ToValue = "PLACEHOLDER";
      SendSMSChoreo.addInput("To", ToValue);
      String AccountSIDValue = "PLACEHOLDER";
      SendSMSChoreo.addInput("AccountSID", AccountSIDValue);
      String FromValue = "PLACEHOLDER";
      SendSMSChoreo.addInput("From", FromValue);

      // Identify the Choreo to run

      // Run the Choreo; when results are available, print them to serial;

      while(SendSMSChoreo.available()) {
        char c =;
    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!

This guide was first published on Oct 29, 2014. It was last updated on Mar 08, 2024.

This page (Adding Code) was last updated on Mar 08, 2024.

Text editor powered by tinymce.