Arduino sketch

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

Now, we are going to build the Arduino sketch. You need to import all the libraries for the Arduino Yun web & bridge functionalities. You can read more about starting out with Temboo & Yun here: https://www.temboo.com/arduino/yun/

These are all the libraries used in this project:

Download: file
#include <Bridge.h>
#include <Temboo.h>
#include <Process.h>
#include <Wire.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_BMP085_U.h>

I also placed all my Temboo account information in a separate file, please make sure that you update your personal account information in this file:

Download: file
#include "TembooAccount.h"

You also need to set your own informations about your Google account:

Download: file
const String GOOGLE_CLIENT_ID = "your-google-client-id";
const String GOOGLE_CLIENT_SECRET = "your-google-client-secret";
const String GOOGLE_REFRESH_TOKEN = "your-google-refresh-token";
const String SPREADSHEET_TITLE = "your-spreadsheet-title";

In the setup() part of the sketch, we initialise the Arduino Bridge library:

Download: file
Bridge.begin();

We also start a date process, to automatically send the measurements date to Google Docs:

Download: file
time = millis();
if (!date.running())  {
  date.begin("date");
  date.addParameter("+%D-%T");
  date.run();
}

In the loop() part, the most important line is:

Download: file
runAppendRow(humidity, lightLevel, pressure, temperature, altitude);

Which calls the function to automatically send the data to the Google Docs spreadsheet. I won’t get into the details of these two functions, but of course you will find all the code in the GitHub repository of this project.

The loop() of the Arduino sketch is repeated every 10 minutes with a delay() function, as these variables are usually changing slowly over time.

This guide was first published on Mar 11, 2014. It was last updated on Mar 11, 2014. This page (Arduino sketch) was last updated on Aug 05, 2019.