i found this code below and i want to use it on lcd 16*2 without I2C
i changed things but i still got errors
this is the "original one"
/*
* Displays text sent over the serial port (e.g. from the Serial Monitor) on
* an attached LCD.
*/
#include <Wire.h>
// include the library code:
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x3F,16,2);
int led1 = 8;
float raw;
byte bl[8] = {
B00000,
B00000,
B00000,
B00000,
B00000,
B00000,
B00000,
};
void setup()
{
pinMode(led1, OUTPUT);
lcd.init(); // initialize the lcd
lcd.backlight();
Serial.begin(9600);
lcd.createChar(1, bl);
lcd.createChar(2, bl);
lcd.createChar(3, bl);
lcd.createChar(4, bl);
lcd.setCursor(0,0);
lcd.print("dd-wrt - powered");
lcd.setCursor(0,1);
lcd.print("ASUS WL500gP v2");
}
void loop()
{
int charcount;
boolean secondline;
if (Serial.available()) {
delay(200);
lcd.clear();
charcount = 0;
secondline = false;
while (Serial.available() > 0) {
if (charcount > 15 && secondline == false ) {
lcd.setCursor(0,1);
secondline = true;
}
char inChar = (char)Serial.read();
if (inChar != '\0') {
lcd.write(inChar);
}
if (inChar == '\1') {
lcd.backlight();
}
if (inChar == '\2')
{
lcd.noBacklight();
}
if (inChar == '\3') {
digitalWrite(led1, HIGH);
}
if (inChar == '\4'){
digitalWrite(led1, LOW);
}
charcount++;
}
}
}
and i change it to this
// include the library code:
#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 10, 9, 8, 7);
float raw;
byte bl[8] = {
B00000,
B00000,
B00000,
B00000,
B00000,
B00000,
B00000,
};
void setup(){
lcd.begin(16, 2);
Serial.begin(9600);
lcd.createChar(1, bl);
lcd.createChar(2, bl);
lcd.createChar(3, bl);
lcd.createChar(4, bl);
lcd.setCursor(0,0);
lcd.print("dd-wrt - powered");
lcd.setCursor(0,1);
lcd.print("cisco e900");
}
void loop()
{
int charcount;
boolean secondline;
if (Serial.available()) {
delay(200);
lcd.clear();
charcount = 0;
secondline = false;
while (Serial.available() > 0) {
if (charcount > 15 && secondline == false ) {
lcd.setCursor(0,1);
secondline = true;
}
char inChar = (char)Serial.read();
if (inChar != '\0') {
lcd.write(inChar);
}
}
}
i am using this code to show up data from a router with dd-wrt
i finished the code on my router and everything work great
i still have no data on my display, i think i removed something important from the original code
is my second code right?!