photo resister and lcd timer HELP!


I have been messing with my arduino and programming for the past 3 weeks or so (not consistently).
I understand how to set up the arduino with the breadboard and components, but I have a hard time
coming up with some commands.

Current Project:
I have set up a photo resister to be activated when the light of a shining red laser beam is interrupted, like a trip wire/sensor. I then programmed my LCD to serve as a timer. Now I’m trying to set them up together.

I want to be able to start the timer once the photo resistor is: activated → dis-activated → activated (shining light on semsor, no laser shines over it, then the laser shines on it again) as if something blocked the sensor for a second then send the signal to start the timer.

I also need to make sure the timer doesnt start counting again if it gets tripped more than once in a single run.

I know how i must set up the arduino physically but I just cant figure out how to code it

the code should say something like this (not a real code):
if the digital input from the photo resistor is HIGH then LOW then HIGH again send a signal to the lcd to start the timer
and then make sure the timer wont restart if the light beam is disrupted again.

I wrote very simple codes for both the lcd timer and the photo resistor

LCD code:

#include <LiquidCrystal.h>

LiquidCrystal lcd(7, 8, 9, 10, 11, 12);

void setup() {
lcd.begin(16, 2);

void loop()
lcd.setCursor(0, 6);

Photo Resistor Code:

/* Photo Resistor */

const int sensorPin = 0;
const int ledPin = 13;
int lightLevel, high = 0, low = 1023;

void setup()
pinMode(ledPin, OUTPUT);

void loop()
lightLevel = analogRead(sensorPin);
analogWrite(ledPin, lightLevel);

void manualTune()
lightLevel = map(lightLevel, 100, 200, 0, 255);
lightLevel = constrain(lightLevel, 0, 255);

Does anyone have any clever ideas on how to set the communication between photo resistor part and the LCD timer?

I suggest you start with a timer project that just uses a switch and displays results on the Serial Monitor. The switch can just be a couple of pieces of wire stuck into an Arduino I/O socket and a GND socket.

You need to record millis() when the switch is pressed. I can't figure from your description how the Arduino will know the time is up and it can accept another switch press. The demo several things at a time shows how to use millis()

When you have this simple code working you can add some code so that the role of the switch iss taken by the LDR and the role of the Serial Monitor is taken by the LCD.


I'm planning on stopping the timer with a pressure sensor later on, thats why i havent focused on stopping

I guess I'll just backtrack a bit and go ahead and figure out how to set up a switch to understand the behavior of the input signal.

Thank you!

I'm planning on stopping the timer with a pressure sensor later on, thats why i havent focused on stopping

I think it will be hard to design the start process without also having at least a rudimentary stop process.