CIRC15 uses code that will work for both the Metro and the Metro Express. You'll need to make a tiny modification to it to get it working with the Metro you own. (If you're not sure what board you have, click here!)

If you're using a Metro EXPRESS, change #define ANALOGREFVOLTAGE to #define ANALOGREFVOLTAGE 3.333


 * CIRC15: Digital Thermometer
 * Experimenter's Guide for Metro (and Metro Express!)
 *  by Brent Rubell for Adafruit Industries ~ Support Open Source, buy adafruit!

// If you're using a METRO EXPRESS, change this value to 3.333

// include the lcd library code:
#include <LiquidCrystal.h>

// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(7, 8, 9, 10, 11, 12);

// TMP36 Pin 
int temperaturePin = 0;

void setup() {
  // set up the LCD's number of columns and rows:
  lcd.begin(16, 2);

void loop() {
  float temperature = 0;
  temperature = getVoltage(temperaturePin);
  /* Output: Degrees C */
  temperature = (temperature - .5) * 100; 
  /* Output: Degrees F */
  // temperature = (((temperature - .5) * 100)*1.8) + 32;
  /* Output: Voltage */
  // temperature = (temperature - .5) * 100; d
  // Write temperature to the LCD
  lcd.print("Temp: ");
  // Wait 1s
  // Refresh the LCD

float getVoltage(int pin) { 
  return(float(analogRead(pin))* float(ANALOGREFVOLTAGE/1023.000));  
After uploading this code, make sure the backlight is lit up and twist the potentiometer until you can clearly see the text/numbers.

Having Trouble? 

I don't see anything on the LCD

Try twisting the potentiometer. If that doesn't work, re-check your wiring. 

Text on the LCD is strange characters or garbled

Make sure the pins of the LCD are flush with the breadboard. If that doesn't work, re-upload the sketch from Arduino. 

The number on the LCD is not possible, it's too high/low

The included code has a line that uses the serial monitor. Pop open the serial monitor and check the number in there against what you think the current temperature is. If the number seems off, double check wiring to Analog Pin A0. 

I'm still having trouble, I think the diagram is too complicated.

The character LCD has a lot of wires and it's hard to keep track. We have a great guide that takes you step-by-step. Check it out!

This guide was first published on Aug 18, 2017. It was last updated on Jun 12, 2017.

This page (Code) was last updated on Jun 28, 2017.

Text editor powered by tinymce.