code do lcd smartie br
Autor: Tigerjon | Publicado: 2015-08-26T03:21:00-07:00












/*

code do lcd smartie 

Caso queria fazer alguma doação:
http://goo.gl/swIl5l

https://www.youtube.com/watch?v=U0X_AdSm-Ks


&nbsp;*/

#include 


#define RS 12
#define E &nbsp;11
#define D4 5
#define D5 4
#define D6 3
#define D7 2


#define VERSION 1

LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

void setup() {
&nbsp; Serial.begin(9600); // Default baudrate.
&nbsp; lcd.begin(16, 2); // Change this for other screen sizes.
&nbsp; lcd.setCursor(0,0);
&nbsp; lcd.print("Arduino");
&nbsp; lcd.setCursor(0, 1);
&nbsp; lcd.print("LCD SMARTIE");
}

byte serial_getch(){

&nbsp; int incoming; 
&nbsp; while (Serial.available()==0){}
&nbsp; // read the incoming byte:
&nbsp; incoming = Serial.read();

&nbsp; return (byte) (incoming &amp;0xff);
}

void loop()
{
&nbsp; byte rxbyte;
&nbsp; byte temp;

&nbsp; rxbyte = serial_getch();
&nbsp; if (rxbyte == 254) {
&nbsp; &nbsp; switch (serial_getch()) {
&nbsp; &nbsp; case 71: &nbsp;//set cursor position
&nbsp; &nbsp; &nbsp; temp = (serial_getch() - 1); &nbsp;//get column byte
&nbsp; &nbsp; &nbsp; switch (serial_getch()) &nbsp;//get row byte
&nbsp; &nbsp; &nbsp; {
&nbsp; &nbsp; &nbsp; &nbsp; //line 1 is already set up
&nbsp; &nbsp; &nbsp; case 2:
&nbsp; &nbsp; &nbsp; &nbsp; temp += 0x40;
&nbsp; &nbsp; &nbsp; &nbsp; break;
&nbsp; &nbsp; &nbsp; case 3:
&nbsp; &nbsp; &nbsp; &nbsp; temp += 0x14;
&nbsp; &nbsp; &nbsp; &nbsp; break;
&nbsp; &nbsp; &nbsp; case 4:
&nbsp; &nbsp; &nbsp; &nbsp; temp += 0x54;
&nbsp; &nbsp; &nbsp; &nbsp; break;
&nbsp; &nbsp; &nbsp; default:
&nbsp; &nbsp; &nbsp; &nbsp; break;
&nbsp; &nbsp; &nbsp; }
&nbsp; &nbsp; &nbsp; lcd.command(0b10000000 + temp);
&nbsp; &nbsp; &nbsp; break;
&nbsp; &nbsp; case 72:
&nbsp; &nbsp; &nbsp; lcd.setCursor(0,0);
&nbsp; &nbsp; &nbsp; break;
&nbsp; &nbsp; case 74:
&nbsp; &nbsp; &nbsp; lcd.cursor();
&nbsp; &nbsp; &nbsp; break;
&nbsp; &nbsp; case 75:
&nbsp; &nbsp; &nbsp; lcd.noCursor();
&nbsp; &nbsp; &nbsp; break;
&nbsp; &nbsp; case 83:
&nbsp; &nbsp; &nbsp; lcd.blink();
&nbsp; &nbsp; &nbsp; break;
&nbsp; &nbsp; case 84:
&nbsp; &nbsp; &nbsp; lcd.noBlink();
&nbsp; &nbsp; &nbsp; break;
&nbsp; &nbsp; case 76:
&nbsp; &nbsp; &nbsp; lcd.command(32);
&nbsp; &nbsp; &nbsp; break;
&nbsp; &nbsp; case 77:
&nbsp; &nbsp; &nbsp; lcd.command(20);
&nbsp; &nbsp; &nbsp; break;
&nbsp; &nbsp; case 78:
&nbsp; &nbsp; &nbsp; lcd.command(64 + (serial_getch() * 8));
&nbsp; &nbsp; &nbsp; for (temp = 7; temp != 0; temp--) {
&nbsp; &nbsp; &nbsp; &nbsp; lcd.print(serial_getch());
&nbsp; &nbsp; &nbsp; }
&nbsp; &nbsp; &nbsp; break;
&nbsp; &nbsp; &nbsp; case 54:
&nbsp; &nbsp; &nbsp; Serial.print(VERSION);
&nbsp; &nbsp; &nbsp; break;
&nbsp; &nbsp; case 55:
&nbsp; &nbsp; &nbsp; Serial.print(9);
&nbsp; &nbsp; &nbsp; break;
&nbsp; 
&nbsp; &nbsp; &nbsp; break;
&nbsp; &nbsp; case 81:
&nbsp; &nbsp; &nbsp; lcd.autoscroll();
&nbsp; &nbsp; &nbsp; break;
&nbsp; &nbsp; case 82:
&nbsp; &nbsp; &nbsp; lcd.noAutoscroll();
&nbsp; &nbsp; &nbsp; break;
&nbsp; &nbsp; case 86:
&nbsp; &nbsp; &nbsp; break;
&nbsp; &nbsp; case 87:
&nbsp; &nbsp; &nbsp; break;
&nbsp; &nbsp; case 88:
&nbsp; &nbsp; &nbsp; lcd.clear();
&nbsp; &nbsp; &nbsp; break;
&nbsp; &nbsp; case 35:
&nbsp; &nbsp; case 38:
&nbsp; &nbsp; case 57:
&nbsp; &nbsp; case 59:
&nbsp; &nbsp; case 61:
&nbsp; &nbsp; case 64:
&nbsp; &nbsp; case 65:
&nbsp; &nbsp; case 67:
&nbsp; &nbsp; case 68:
&nbsp; &nbsp; case 66:
&nbsp; &nbsp; case 69:
&nbsp; &nbsp; case 70:
&nbsp; &nbsp; case 79:
&nbsp; &nbsp; case 85:
&nbsp; &nbsp; case 96:
&nbsp; &nbsp; case 152:
&nbsp; &nbsp; case 153:
&nbsp; &nbsp; case 104:
&nbsp; &nbsp; case 109:
&nbsp; &nbsp; case 110:
&nbsp; &nbsp; case 111:
&nbsp; &nbsp; case 115:
&nbsp; &nbsp; case 118:
&nbsp; &nbsp; case 124:
&nbsp; &nbsp; case 126:
&nbsp; &nbsp; case 145:
&nbsp; &nbsp; case 160:
&nbsp; &nbsp; case 192:
&nbsp; &nbsp; case 164:
&nbsp; &nbsp; case 193:
&nbsp; &nbsp; case 194:
&nbsp; &nbsp; case 195:
&nbsp; &nbsp; case 200:
&nbsp; &nbsp; &nbsp; switch (serial_getch()) {
&nbsp; &nbsp; &nbsp; case 1:
&nbsp; &nbsp; &nbsp; case 2:
&nbsp; &nbsp; &nbsp; default:
&nbsp; &nbsp; &nbsp; &nbsp; break;
&nbsp; &nbsp; &nbsp; }
&nbsp; &nbsp; &nbsp; break;
&nbsp; &nbsp; case 213:
&nbsp; &nbsp; default:
&nbsp; &nbsp; &nbsp;temp = serial_getch();
&nbsp; &nbsp; &nbsp; break;
&nbsp; &nbsp; }
&nbsp; &nbsp; return;
&nbsp; }
&nbsp; lcd.write(rxbyte);
}