Device Coder Walkthrough


Here we'll walk you through how to use the Device Coder. In this example we'll generate code that senses a change in light and reacts by sending an email alert. We'll be using an Arduino Uno with an Arduino Wifi shield and mini photocell, but the process is essentially the same for any supported board. If you want to follow along, you'll need an Arduino or Arduino-compatible board, a way to connect it to the internet, a photocell sensor, and a Gmail account.

Get Started

1First, make sure that you've got the latest version the Arduino IDE installed.

2With that out of the way, log in to Temboo. If you don't have an account, you can create one for free here.

3Next, open the Device Coder in a new tab so that you can follow along here while generating the code that will monitor the light level and trigger an email.

Enter Your Details

4First, we'll set up the condition that triggers the email. For this app, any sensor value greater than 300 will cause an email to be sent, and we'll use the pin selector to specify that our our photocell is connected to pin A5.

Device Coder's pin selector in action

5Next, create a new Credential to hold your Gmail account details. Click on the New Google Account button, give your Credential a name e.g,. myGmailAccount, and enter your Gmail account details.

Creating a Gmail Credential in the Device Coder

If you'd like to learn more about Credentials, you can do so here.

6Now it's time to supply details of the email you want to send. You can use {SensorValue} to pass the sensor value that triggered the email.

Setting up the email content

7Next you've got the option to specify numerous actions to take on the board once the email has been triggered. We'll leave the defaults in place this time, writing HIGH to digital output pin 6.

8The last thing we need to do before generating the code is specify how our board is connecting to the internet. We're using the Arduino WiFi shield to connect to a network in my home, and we've saved the details as "HomeOffice".

A populated internet shield credential popup

Generate your code

9Now we're ready to generate the code. Before you can do that, you'll be asked to give a name to the details you just entered. We save these as a single Device Input object on our platform so that they can be referenced from your sketch with a single line of code, saving precious RAM on your board. Saving your inputs also means that you can use them to easily generate the same code in the future, or use them as the basis for a similar project.

Naming your Device Inputs

10That's it! Copy both of the generated files into separate tabs in your Arduino IDE, make sure you've got the Temboo Arduino library installed, hook up your board, and run the sketch. Enjoy!

What Next?

Now that you know how to use the Device Coder, you're ready to create all sorts of projects that use sensor data to trigger an array of useful actions. We'd love to hear about what you make - hey@temboo.com

Need Help?

If you ever need help with the Device Coder, now or in the future, please don't hesitate to get in touch.

Email us at support@temboo.com and we'll answer your questions.


Back