Simple IFTTT Recipe - increase counter when new Twitter follower follows

Screen Shot 2015-12-05 at 11.46.43 AM

INTRO

IFTTT is a service that to create control and connection over the products and apps that you love. In this demo, we will connect two channels, Twitter and Particle Cloud, and create a simple recipe that whenever a new follower to our twitter account (@redbearlab), we will add one and display on a 4 Digital Display.

SETUP

Hardware setup - Use RedBear Duo and RB Link together, and connect Grove 4 digital display to D4 and D5. (or other digital pins on RBLink with Grove cable).

USE

First, create a recipe in your IFTTT account.
While creating recipe, the procedures are:

  • Choose a Trigger - select Twitter Channel (you may prompt to connect to your twitter account if you have not done that) in step 1, and select "New Follower" in step 2. Click Create Trigger in step 3.

    Screen Shot 2015-12-05 at 12.10.56 PM

  • Choose Action - Select Particle Channel (you may prompt to connect to your twitter account if you have not done that) in step 4. Select "Publish an event" in step 5.

    Screen Shot 2015-12-05 at 12.14.31 PM

  • Define your Action - We will use Particle Cloud's Publish/Subscribe abilities. In step 6, create a Event Name. We named our event "newfollower". In Data Field, you can apply any data you want to to publish along with this event when there is new follower. In our case, we just send an String "add".

    Screen Shot 2015-12-05 at 12.19.04 PM.

  • Click Create Action. In Step 7, name your recipe and click create Recipe.

Now your IFTTT recipe is ready.

Power on RedBear Duo if you have not. Make sure RGB LED is breathing cyan (connected to Particle Cloud Status).

Login Particle and click build to start Particle's Web IDE

In Web IDE, Make sure that you select RedBear Duo as a target device.

Screen Shot 2015-12-05 at 12.32.13 PM

Create a new App and add TM1637Display Library to the project.

Screen Shot 2015-12-05 at 12.33.17 PM

Then copy the following code and paste it in your new App.

[gist id="450529030c044cf9d770" file="IFTTT-newFollower.ino"]

Compile and flash your Duo, and when you see the RGB LED is cyan breathing again, it is IFTTT ready with less than 30 lines of code!

IMG_6272

Whenever there is a new Twitter follower, you will see the number on 4 digital display increase by one(It may take sometime for you to see a new follower).

NOTES

  • Currently, if someone unfollowed(please no~), you would not see decrement because we did not implement it. However, it is easy to apply your own logic here.
  • What if more than 9999 followers? You may see missing figure.
  • Improvement? To make it more fun, may add a buzzer buzzing when a new follower follows. Use Maker Channel and your own scrapping method to get the correct number of followers. Change to LCD Display. etc.
  • So, what will you make today? :)

Hope you enjoy this Demo and have fun! Follow @redbearlab now to trigger our IFTTT recipe!