Skip to content
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
108 lines (67 sloc) 2.28 KB

Intel Edison + Grove - RGB LCD temperature display

Using Johnny-Five with Grove's RGB LCD and Thermometer components on the Intel Edison Arduino Breakout. This shield and component will work with any Arduino pin-out compatible hardware platform.

Run this example from the command line with:

node eg/grove-lcd-rgb-temperature-display-edison.js
var five = require("johnny-five");
var Edison = require("edison-io");
var board = new five.Board({
  io: new Edison()

board.on("ready", function() {

  // Plug the Temperature sensor module
  // into the Grove Shield's A0 jack
  var thermometer = new five.Thermometer({
    controller: "GROVE",
    pin: "A0"

  // Plug the LCD module into any of the
  // Grove Shield's I2C jacks.
  var lcd = new five.LCD({
    controller: "JHD1313M1"

  var f = 0;

  thermometer.on("data", function() {

    // The LCD's background will change
    // color according to the temperature.
    // Hot -> Warm: Red -> Yellow
    // Moderate: Green
    // Cool -> Cold: Blue -> Violet
    // Experiment with sources of hot and
    // cold temperatures!

    if (f === Math.round(this.fahrenheit)) {

    f = Math.round(this.fahrenheit);

    var r = linear(0x00, 0xFF, f, 100);
    var g = linear(0x00, 0x00, f, 100);
    var b = linear(0xFF, 0x00, f, 100);

    // console.log("Fahrenheit:  %d°", f);

    lcd.bgColor(r, g, b).cursor(0, 0).print(f);

// [Linear Interpolation](
function linear(start, end, step, steps) {
  return (end - start) * step / steps + start;

Additional Notes

For this program, you'll need: Grove Base Shield v2 Grove - LCD RGB w/ Backlight Grove - Temperature Sensor



Copyright (c) 2012-2014 Rick Waldron Licensed under the MIT license. Copyright (c) 2015-2019 The Johnny-Five Contributors Licensed under the MIT license.

You can’t perform that action at this time.