Things used in this project

Hardware components:
102110017%206
MediaTek Labs LinkIt Smart 7688 Duo
×1
181 02
Adafruit Standard LCD - 16x2 White on Blue
×1
12002 04
Breadboard (generic)
×1
11026 02
Jumper wires (generic)
×1
Software apps and online services:
Ide web
Arduino IDE
Hand tools and fabrication machines:
09507 01
Soldering iron (generic)

Schematics

schematic, how to connect the LCD
the schematic to wire the lcd and the linkit
schematic_a9ATWclcWH.fzz
schematic, how to connect the LCD
same as fritzing file but jpg
Schematic bb zcnnftdvnh

Code

smartlink_heroku_lcd.inoArduino
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

Photo
Andrea De Gaetano

An italian developer.Interested in mobile dev and security. I love coding on different things! This is my blog http://pestohacks.blogspot.com

Replications

Did you replicate this project? Share it!

Love this project? Think it could be improved? Tell us what you think!

Give feedback

Comments

ProjectsCommunitiesContestsLiveAppsBetaFree StoreBlogAdd projectSign up / Login
Respect project
Feedback