If this is your first time using Temboo, you'll need to set up your ARTIK board to find the Temboo libraries. To do so, you'll need to create the file temboo.conf
in /etc/ld.so.conf.d
. Inside of temboo.conf
, you'll want to copy the line below and paste it into the file:
/opt/iothub/artik/temboo/temboo_artik_library/lib
After saving temboo.conf
, run ldconfig
from the command line to add the Temboo library directory to the system library search path.
You’ll also need to get the IP address of your ARTIK board using ifconfig
. The example below shows the results when the ARTIK board is connected to the internet through an ethernet cable. The IP address you'll want to use is listed next to inet.
[root@localhost ~]$ ifconfig eth0: flags=4163mtu 1500 inet 10.11.6.200 netmask 255.255.255.0 broadcast 10.11.6.255
Get Set Up
1Start by logging in to Temboo. If you don't have an account you can create one for free here.
2Go to the Yahoo > Weather > GetWeatherByAddress Choreo in our Library.
The Yahoo! GetWeatherByAddress Choreo in our Library
3Enter any address in the Address input field e.g., 104 Franklin St New York, NY 10013.
4Now click Generate Code to test the Choreo from our website. After a moment you'll see the data that Yahoo! Weather sends back shown in the OUTPUT section of the page (which is right below the Input section).
The output from the Yahoo! Weather API (which is in XML format)
Auto-Generate your ARTIK Code
When you run a Choreo from the website, Temboo automatically generates code that can be used to make the same API call from your ARTIK.
5Select "Samsung" from the drop down menu at the top of the Choreo page.
6If you'd like the Choreo to be triggered by a sensor event, or if you'd like the Choreo result to trigger an actuator event, you can specify conditions above and below the Choreo inputs and we'll generate the application logic code you need. Use the visual pin board to set up a sensor or actuator and the conditions option will appear. You can learn more about conditions here.
7Scroll down to the CODE section of the Library page. There you'll find the auto-generated C code that you can run on your ARTIK.
Uploading to the ARTIK Board
8Download the generated code to your computer by clicking the Download button.
9Copy the downloaded zip file to your ARTIK board using scp
. From your computer, go to the directory where the zip file is located and type the command below. Make sure you use the IP address for your board you found using ifconfig
.
[root@localhost ~]$ scp getweatherbyaddress.zip root@xxx.xxx.xxx.xxx:/home
Run the code and rejoice
10From the ARTIK command line (either through a serial terminal or ssh session), change your current directory to /home
. Next, unzip the generated code you just copied over. You can unzip the file by using the command below:
[root@localhost ~]$ unzip getweatherbyaddress.zip
11Now go to the getweatherbyaddress directory and compile and run your code using the commands below. Run the first command to compile your code. After compiling has finished and no errors have been reported, run your program using the second command. After running the program, you should see the response from Yahoo! Weather in your console.
[root@localhost ~]$ gcc -L/opt/iothub/artik/temboo/temboo_artik_library/lib -ltemboo -I/opt/iothub/artik/temboo/temboo_artik_library/include getweatherbyaddress.c -o getweatherbyaddress [root@localhost ~]$ ./getweatherbyaddress
Note: If you get an error about cdefs.h not being found, this could mean your ARTIK board was not shipped with glibc-headers. This can be solved by reinstalling glibc-headers using the command below. After reinstalling glibc-headers, run the two commands above to compile and run your code.
[root@localhost ~]$ yum reinstall glibc-headers
Congratulations! This same approach will work with your ARTIK for all of our 2000+ Choreos. Because these ready-to-run tasks take care of so many steps, we named them after choreographies. Now that you know how to make your ARTIK run any Choreo, you're just a few steps away from making something extraordinary. With Temboo handling all the small stuff, you're free to think big.
What's Next?
Now that you've got something simple up and running, why not move on try making your board do something more advanced?
Need help?
We're always happy to help. Just email us at support@temboo.com, and we'll answer your questions.