#include <LiquidCrystal.h>
#include "Bigfonte.h" 

long i  = 0;
int col = 0;

const int lcdD7Pin = 7; // LCD D7 pin
const int lcdD6Pin = 6; // LCD D6 pin
const int lcdD5Pin = 5; // LCD D5 pin
const int lcdD4Pin = 4; // LCD D4 pin
const int lcdEPin =  9; // LCD E  Pin
const int lcdRSPin = 8; // LCD RS pin

LiquidCrystal lcd(lcdRSPin, lcdEPin, lcdD4Pin, lcdD5Pin, lcdD6Pin, lcdD7Pin); // construct LCD object
LCDBigNumbers lcdNum(&lcd, 0, 0); //inclui uma barra no lcd, primeira linha, coluna 8. tamanho 8

void setup()
{
  lcd.begin(16, 2);
  lcd.setCursor(0, 0);
  lcd.write ("    BigFont   ");
  lcd.setCursor(0, 1);
  lcd.write ("   =========    ");
  delay(2000);
  lcd.clear();

  lcdNum.createChars();

  lcd.setCursor(1, 1);
  lcd.print("FM");
  lcd.setCursor(9, 0);
  lcd.print("MHz");
  lcd.setCursor(12, 1);
  lcd.print("8/15");
  lcd.setCursor(14,0);
  lcd.print("St");
}

void loop()
{
  static long val = 870;

  val++;

  if (val > 1080) val = 870;

  if (val > 999)
  {
    lcdNum.setCol(4);
    lcdNum.setValue (val);

    lcd.setCursor(7, 0);
    lcd.print(val % 10);
    lcd.setCursor(7, 1);
    lcd.print(" ");

  }
  else
  {
    lcdNum.setCol(5);
    lcdNum.setValue (val);

    lcd.setCursor(7, 0);
    lcd.print(val % 10);
    lcd.setCursor(7, 1);
    lcd.print(" ");
  }

  delay(500);
}