Andrea De Gaetano
Published © GPL3+

Heroku Status

Use a LinkIt 7688 Smart Duo to track the status of your Heroku applications... or another service!

IntermediateFull instructions provided3 hours582
Heroku Status

Things used in this project

Hardware components

Standard LCD - 16x2 White on Blue
Adafruit Standard LCD - 16x2 White on Blue
×1
Breadboard (generic)
Breadboard (generic)
×1
Jumper wires (generic)
Jumper wires (generic)
×1

Software apps and online services

Arduino IDE
Arduino IDE

Hand tools and fabrication machines

Soldering iron (generic)
Soldering iron (generic)

Story

Read more

Schematics

schematic, how to connect the LCD

the schematic to wire the lcd and the linkit

schematic, how to connect the LCD

same as fritzing file but jpg

Code

smartlink_heroku_lcd.ino

Arduino
This code should be wrote on the device through arduino ide.
/*
  LiquidCrystal Library - Hello World
 Library originally added 18 Apr 2008
 by David A. Mellis
 library modified 5 Jul 2009
 by Limor Fried (http://www.ladyada.net)
 example added 9 Jul 2009
 by Tom Igoe
 modified 22 Nov 2010
 by Tom Igoe

 This example code is in the public domain.

 http://www.arduino.cc/en/Tutorial/LiquidCrystal
 */

// include the library code:
#include <LiquidCrystal.h>
#include <Bridge.h>
// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
const int maxLine = 16;
String list[maxLine];
void setup() {

  Bridge.begin();
  // set up the LCD's number of columns and rows:
  lcd.begin(16, 2);
  // Print a message to the LCD.
  lcd.print("");
  lcd.setCursor(0, 0);
  lcd.print("Loading...");
}

void loop() {
  for(int i=0;i<maxLine;i++){
    list[i] = "                ";
  }
  
  Process p;
  p.begin("python");
  p.addParameter("/IoT/heroku/service.py");
  p.run();
  int line = 0;
  list[0]="";
  while(p.available() > 0) {
    char c = p.read();
    if( c=='\n' ) {
      line ++;
      if( line >= maxLine ) {
        line = maxLine;
        break;
      }
      list[line]="";
    } else {
      list[line]+=c;
    }
  }
  int counted = line;

  for( int j=0;j<10;j++) {
    for( int i=0;i<counted;i+=2 ) {
      lcd.setCursor(0, 0);
      lcd.print(list[i]);
      lcd.setCursor(0, 1);
      lcd.print(list[i+1]);
      delay( 30 * 1000 );
    }
  }
}

The script to run in the linux side of the board.

Python
This basically downlod informations from heroku for my application running on heroku platform.
It download a JSON and display some field on the console.
You have to create a file name TheConf.py and put in the same directory with code
token="yourherokutokenhere";
to generate a token execute, heroku auth:token from your environment.
import urllib2
import json
import TheConf
req = urllib2.Request('https://api.heroku.com/apps/sheltered-dawn-39381')
req.add_header('Accept', 'application/vnd.heroku+json; version=3')
req.add_header('Authorization', 'Bearer ' + TheConf.token);
resp = urllib2.urlopen(req)
content = resp.read()
jdata = json.loads(content);
relAt = jdata['released_at'][2:];
updAt = jdata['updated_at'][2:];
print 'Released At '
print relAt.replace('T',' ');
print 'Updated At '
print updAt.replace('T',' ');

Credits

Andrea De Gaetano

Andrea De Gaetano

10 projects • 25 followers
Interested in iot, mobile and security Love hackathons This is my blog http://pestohacks.blogspot.com

Comments