[HELP] Getting light sensor to act as switch

Hi All,

I am working on a student project and need help writing an "if" statement that allows a light sensor to act as a switch that will then display text on an lcd monitor.

Display:

RGB backlight positive LCD 16x2 + extras - black on RGB

Light Sensor:

Adafruit TSL2591 High Dynamic Range Digital Light Sensor

Example:

If the light sensor detects a luminosity of 200 Lux, then display the word "Light On" on the LCD Monitor.

Setup:

|500x348

The LCD Monitor and the Light Sensor are both working independently on the same breadboard

you need to hold state

state = 0;

b = digitalRead(pin);

if (b == HIGH && state == 0) { state = 1; do something } if (b == LOW && state == 1) { state = 0; do something else }