Hello everyone , I am still very new to arduino and this forum and wanted to ask a question regarding tinkercad, I am running a traffic light simulation and was wondering why although the lights work, the lcd would not come on, am i doing something wrong that i do not know? no errors but lcd is just being passed.
What a mess. Make your wires parallel, different colors, and cross at right angles. Also, when posting code, use the < CODE > button in the message box to start a code block, then paste your code where you see ```type or paste code here```
yes i know its a mess haha, not a perfectionist just want to get the job done first before making it pretty, but my main concern is the coding not the presentation of the circuit.
``
//
#include <LiquidCrystal_I2C.h>
#include <Wire.h>
LiquidCrystal_I2C lcd_1(0x22,16,2);
void setup()
{
lcd_1.begin(16, 2);
pinMode(13, OUTPUT);
pinMode(12, OUTPUT);
pinMode(11, OUTPUT);
lcd_1.setCursor(0, 1);
lcd_1.setBacklight(1);
lcd_1.display();
}
void loop()
{
LiquidCrystal_I2C lcd_1(0x22,16,2);
lcd_1.setCursor(0, 1);
digitalWrite(13, HIGH);
lcd_1.clear();
lcd_1.print("GO");
delay(5000); // Wait for 5000 millisecond(s)
digitalWrite(13, LOW);
lcd_1.clear();
lcd_1.print("SLOW DOWN");
digitalWrite(12, HIGH);
delay(2000); // Wait for 2000 millisecond(s)
digitalWrite(12, LOW);
lcd_1.clear();
lcd_1.print("STOP");
digitalWrite(11, HIGH);
delay(7000); // Wait for 7000 millisecond(s)
digitalWrite(11, LOW);
}[quote="xfpd, post:2, topic:1312508, full:true"]
What a mess. Make your wires parallel, different colors, and cross at right angles. Also, when posting code, use the < CODE > button in the message box to start a code block, then paste your code where you see ```type or paste code here```
[/quote]
heres the code btw ![]()
Hi, @2kenny4u
Welcome to the forum.
The link will tell you how to post your code so it is in a scrolling window.
Thanks.. Tom..
![]()
The point is not to make it look pretty, but to make it understandable. Do you understand?
How can we review your "schema" if it is almost illegible?
And how can we read your code when it is all piled up like plain text?
Use the <CODE/> tool in the message composition window tool bar and paste your code where it says.
But this
void loop()
{
LiquidCrystal_I2C lcd_1(0x22,16,2); // lose this. What it does needs doing once, you did it aready
At least. More if you post code we can read. Easily.
a7
Hey, kenny... clean up the code posting, too. Put three back-ticks (on the "tilde" key) before your code and after your code, like this...
```
// paste code here
```
You should verify your LCD address. I believe it is 0x27.... but I could be wrong, and your LCD address could be 0x22.
You shouldn't re-declare lcd_1 every loop. The global declaration should work.
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.
