LCD ERROR FIX, With LDR and Laser 10k Resister

Hi Arduino Legends :wink:

Having issue getting my Ardunio code to be able to respond to my 12x6 LCD. Basically i have 5 Lasers connected to an external 3volt Battery and 5LDRs that are connected to 5 10k resisters but also soldiered on are 5 cables running to analog inputs [A1-A5].

I have attached the schematics/diagram from fritzing to the post along with the code which i have so far in the text.
If any one can give me any help would be appreciated.

Thank you
..............

#include <LiquidCrystal.h>

// include the library code:
#include <LiquidCrystal.h>

// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

int photoRPin = 1;
int minLight;
int maxLight;
int lightLevel;
int adjustedLightLevel;
int oldLightLevel;

void setup() {
// set up the LCD's number of columns and rows:
lcd.begin(16, 2);
// Print a message to the LCD.
lcd.print("Smoking Kills");
Serial.begin(9600);

//Setup the starting light level limits
lightLevel=analogRead(photoRPin);
minLight=lightLevel-10;
maxLight=lightLevel;
oldLightLevel=lightLevel;

int threshold=50;
lcd.setCursor(0, 0);
if (analogRead(A1)<threshold) lcd.print('0'); else lcd.print('1');
if (analogRead(A2)<threshold) lcd.print('0'); else lcd.print('1');
if (analogRead(A3)<threshold) lcd.print('0'); else lcd.print('1');
if (analogRead(A4)<threshold) lcd.print('0'); else lcd.print('1');
if (analogRead(A5)<threshold) lcd.print('0'); else lcd.print('1');
}

void loop() {
// set the cursor to column 0, line 1
// (note: line 1 is the second row, since counting begins with 0):
lcd.setCursor(0, 1);
// print the number of seconds since reset:
lcd.print(millis()/1000);

lightLevel=analogRead(photoRPin);
delay(10);

//auto-adjust the minimum and maximum limits in real time
if(minLight>lightLevel){
minLight=lightLevel;
}
if(maxLight<lightLevel){
maxLight=lightLevel;
}

//Map the light level to produce a result between 1 and 28.
adjustedLightLevel = map(lightLevel, (minLight+20), (maxLight-20), 1, 28);
adjustedLightLevel = constrain (adjustedLightLevel, 1,28);

/Only send a new value to the Serial Port if the
adjustedLightLevel value changes.
/
if(oldLightLevel==adjustedLightLevel){
//do nothing if the old value and the new value are the same.
}else{
//Update the oldLightLevel value for the next round
oldLightLevel=adjustedLightLevel;

/Send the adjusted Light level result
to Serial port (processing)
/
Serial.println(adjustedLightLevel);
}
}

TEST_LDR_NM.ino (2.09 KB)

Start here: http://forum.arduino.cc/index.php?topic=149015.0

Then answer: Which part works and which doesn't? What shows up on the display? Have you used the serial monitor for troubleshooting?

what i expecting to see in the LCD is when you remove the content i.e bar tube from the LDR and the laser, it should respond with a message on the LCD. i would like to know if there is code available to this.

Atm i have my name displayed on the LCD with the codes for "Liquid Crystal". That's what i got so far.

Diagram in text -

[Battery Powers Laser] - Content in between - [LDR] - Connected to an Analog input [i.e A1]. When content is removed, should be shown on LCD. (Like text format saying, A1 Content removed).