Page 159 - Programming the Photon Getting Started With the Internet of Things
P. 159

8




                                                     IFTTT











        IFTTT stands for “if this then that” and does exactly that. IFTTT is a Web service that

        allows you to link real-time information to your Photon board. The platform works by
        users creating recipes such as “if my favorite football team scores, then send me an e-
        mail.” IFTTT is also well integrated to popular Web platforms such as Twitter, Facebook,
        Google  Mail,  and  many  more.  Moreover,  the  IFTTT  platform  can  integrate  with  our

        Photon board such that if some action is triggered, such as temperature, motion, or any
        data from other sensors, then you can define what to do next, such as sending a tweet or an
        e-mail to someone. This is the basic principle of how the IFTTT platform works, and next
        we’ll be taking a closer look at how we can connect this service to our Photon board.




        If This Then That


        Before we get started, you need to register an account with IFTTT, which is completely
        free, from https://ifttt.com/.  Once  you  have  registered  your  details,  you  can  get  started

        with writing your very own recipes to do all sorts of weird and wonderful things. IFTTT
        also give users options to share recipes so you, too, can share your recipes with the world
        —after all, we should be great believers in open source.

             As  previously  mentioned,  IFTTT  integrates  into  a  lot  of  Web  services  such  as

        Facebook, Twitter, and Google Mail. If you want to use these services in your recipes, you
        need to grant IFTTT access to these through the APIs. Feel free at this point to explore all
        the  other  applications  that  are  available  to  you,  as  well  as  read  some  getting  started
        instructions,  which  also  would  be  useful—maybe  try  out  a  few  of  the  existing  recipes

        before we get started to get a feel for how it works.



        Sunrise E-mail Alert



        This project uses the same fundamentals as in Chapter 5. In that chapter we looked at
        using a photocell as an input device using the analogRead() function. If you haven’t done
        so already, I would highly recommend referring back to this chapter before proceeding. If
        you have purchased the Photon kit, then you should have received some resistors and a

        photoresistor, among other components. You can actually wire this circuit up without any
        jumper wires if you do not have any at hand by using one of the analog pins as a 3.3-V
   154   155   156   157   158   159   160   161   162   163   164