for some reason it will run regular blink but not the lcd version even though its uploads both of them fine and the lcd works and is on. the lcd is wired correctly and i triple checked everything and use 2 diffrents board but it still wont work, can i have some help ![]()
Welcome to the forum
We need more details
Please post your full sketch, using code tags when you do
Posting your code using code tags prevents parts of it being interpreted as HTML coding and makes it easier to copy for examination
In my experience the easiest way to tidy up the code and add the code tags is as follows
Start by tidying up your code by using Tools/Auto Format in the IDE to make it easier to read. Then use Edit/Copy for Forum and paste what was copied in a new reply. Code tags will have been added to the code to make it easy to read in the forum thus making it easier to provide help.
Please post a schematic of your project showing how each of the components of it are connected and powered. A 'photo of a hand drawn circuit diagram is good enough
To post images etc. you need trust level 1, you can get there by:
- Entering at least 5 topics
- Reading at least 30 posts
- Spend a total of 10 minutes reading posts
Users at trust level 1 can...
- Use all core Discourse functions; all new user restrictions are removed
- Send PMs
- Upload images and attachments
There are TWO types of LCD wiring. (1) IIC/I2C and (2) Parallel.
The "parallel" version of an "LCD blink" sketch will only work if you "modulate" the Anode pin of the LCD.
The wiring for parallel (with relay for Anode modulation):
The sketch for parallel (note: library):
#include <LiquidCrystal.h> // library
byte rs = 12, en = 10, d4 = 5, d5 = 4, d6 = 3, d7 = 2; // pins for the LCD
LiquidCrystal lcd(rs, en, d4, d5, d6, d7); // configure LCD instance
unsigned long timer, timeout = 1000; // timing
byte relayPin = 13; // pin to control relay
void setup() {
pinMode(relayPin, OUTPUT); // configure relay pin
digitalWrite(relayPin, HIGH);
lcd.begin(16, 2); // start LCD
lcd.setCursor(5, 0); // cursor on first row, seventh column
lcd.print("Hello,"); // print message on LCD
lcd.setCursor(5, 1); // cursor on second row, seventh column
lcd.print("World!"); // print message on LCD
}
void loop() {
if (millis() - timer >= timeout) { // wait for timeout
timer = millis(); // reset timer
digitalWrite(relayPin, !digitalRead(relayPin));
}
}
The I2C/IIC version of "LCD blink" has a means of cycling the backlight on and off, like this:
The wiring for I2C:
The sketch for I2C: (note the library)
#include <LiquidCrystal_I2C.h> // library
#define ADDR 0x27 // LCD address
#define COLS 16 // LCD columns
#define ROWS 2 // LCD rows
LiquidCrystal_I2C lcd(ADDR, COLS, ROWS); // configure LCD instance
unsigned long timer, timeout = 1000; // timing
bool toggle; // a toggle bit
void setup() {
lcd.init(); // start LCD
lcd.backlight(); // backlight on
lcd.setCursor(5, 0); // cursor on first row, seventh column
lcd.print("Hello,"); // print message on LCD
lcd.setCursor(5, 1); // cursor on second row, seventh column
lcd.print("World!"); // print message on LCD
}
void loop() {
if (millis() - timer >= timeout) { // wait for timeout
timer = millis(); // reset timer
if (!toggle) // check toggle bit
lcd.noBacklight(); // backlight off
else
lcd.backlight(); // backlight on
toggle = !toggle; // toggle bit
}
}

