quarta-feira, 5 de julho de 2017

CARACTER ANIMADO #1

// Programa caracter animado display lcd i2c;

int brilho = 0;
int tempo = 5;
int estado = 1;
float tencao = 0;

// PARAMETROS DO LCD ****************************************

#include <Wire.h>
#include <LCD.h>
#include <LiquidCrystal_I2C.h>
#define I2C_ADOR 0x3F // <<
#define BACKLIGHT_PIN 3
#define En 2
#define Rw 1
#define Rs 0
#define D4 4
#define D5 5
#define D6 6
#define D7 7
LiquidCrystal_I2C lcd(I2C_ADOR,En,Rw,Rs,D4,D5,D6,D7);

// **********************************************************

#include <IRremote.h>

int RECV_PIN = 13;
int  comando = 0;

IRrecv irrecv(RECV_PIN);

decode_results results;

byte smiley[8] = {
  B00000,
  B10001,
  B00000,
  B00000,
  B10001,
  B01110,
  B00000,
};

byte smiley1[8] = {
  B00000,
  B10001,
  B00000,
  B00000,
  B10001,
  B01110,
  B00000,
};

byte smiley2[8] = {
  B00000,
  B10001,
  B00000,
  B00000,
  B10001,
  B01110,
  B00000,
};

void setup()
{
  Serial.begin(9600);
  lcd.begin (16,2);
  lcd.setBacklightPin(BACKLIGHT_PIN,POSITIVE);
  lcd.setBacklight(HIGH);
  irrecv.enableIRIn(); // Start the receiver
  lcd.createChar(0, smiley);
  lcd.createChar(1, smiley1);
  lcd.createChar(2, smiley2);
}

void loop()
{
 
 
  lcd.setCursor(0,0);
  lcd.write(byte(0));
  delay(500);
  lcd.setCursor(0,1);
  lcd.write(byte(0));
  delay(500);
  lcd.setCursor(0,2);
  lcd.write(byte(0));
  delay(500);
 
  //lcd.scrollDisplayLeft();
  //delay(500);
}

Nenhum comentário:

Postar um comentário