Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

But can you tell me where is the error Because the color doesn\'t show in lcd Ca

ID: 2083452 • Letter: B

Question

But can you tell me where is the error Because the color doesn't show in lcd Can you help me with it .. " the full qustion in the end "

#include<LiquidCrystal.h>
int ledRed = 9; int ledBlue = 10; int ledGreen = 13; LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
void setup() { // put your setup code here, to run once: lcd.begin(16, 2); lcd.cursor(); pinMode(ledRed, OUTPUT); pinMode(ledBlue, OUTPUT); pinMode(ledGreen, OUTPUT); Serial.begin(9600);
}
void loop() { // put your main code here, to run repeatedly: lcd.setCursor(0, 0);
digitalWrite(ledRed, HIGH); lcd.print("Red"); delay(3000); digitalWrite(ledRed, LOW); lcd.clear(); digitalWrite(ledBlue, HIGH); lcd.print("Blue"); delay(3000); digitalWrite(ledBlue, LOW); lcd.clear(); digitalWrite(ledGreen, HIGH); lcd.print("Green"); delay(3000); digitalWrite(ledGreen, LOW); lcd.clear();

} DIG R22: 2 11: HY: ::/MI:::::l: :::::::I::::::::::::::::::::::

Explanation / Answer

Ensure these things before you start the Arduino:

Power supply pins:

LCD Vcc to +5V pin as almost all small devices manufactured to work at this voltage level and

LCD Gnd(Vee) to Gnd pin.

Next,

Lcd pins:

LCD RS pin to digital pin 12

LCD Enable pin to digital pin 11

LCD D4 pin to digital pin 5

LCD D5 pin to digital pin 4

LCD D6 pin to digital pin 3

LCD D7 pin to digital pin 2

LCD R/W pin to ground

If these are correct then there will be no problem with the connection in any way and problem will present in your code.

I had saw your code there are some mistakes you have made I highlight those things in bold letters check with those things:

#include<LiquidCrystal.h>

int ledRed = 9;

int ledBlue = 10;

int ledGreen = 13;

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

void setup() {

lcd.begin(16, 2);

lcd.cursor(); //This function is not required and it is used for Control of the underscore-style cursor

pinMode(ledRed, OUTPUT);

pinMode(ledBlue, OUTPUT);

pinMode(ledGreen, OUTPUT);

Serial.begin(9600);

}

void loop() {

lcd.setCursor(0, 0);

digitalWrite(ledRed, HIGH);

lcd.print("Red");

delay(3000);

digitalWrite(ledRed, LOW);

lcd.clear(); //once clear the data you should once again reinitialize the lcd.setCursor(0,0); as clear function removes the whole data stored in lcd & it don't next time from where it has to start. Hence again include

lcd.setCursor(0, 0);

digitalWrite(ledBlue, HIGH);

lcd.print("Blue");

delay(3000);

digitalWrite(ledBlue, LOW);

lcd.clear();//Here also once again include

lcd.setCursor(0, 0);

digitalWrite(ledGreen, HIGH);

lcd.print("Green");

delay(3000);

digitalWrite(ledGreen, LOW);

lcd.clear();//Here also once again not required as loop repeats

}

Still after making these connections of lcd and arduino and editing of code problem persists just reply on comment I will guide you further.