Different LED lights based on light sensor value

Hello. I am a college student trying to do a project using the Lilly Pad Prototyping kit. I'm trying to get the board to where the green light comes on if it's a really bright room, the orange light comes on if it's a little darker, and the red light comes on if it's really dark (using the light sensor). I'm just starting out trying to understand the coding, so if anyone could help or provide some example code, I would really appreciate it. Thanks!

We need to know what light sensor that you are using. A data sheet or part number for the sensor.

What have you tried? Post your best effort of writing the code. Describe what the code does and how that differs from what you want to do.

Read the how to use this forum sticky to see how to post code and some advice on how to get the most from the forum.

I always recommend that you start small, work on the input & output separately, and "develop" your code a little at a time.

So, maybe start with the input (light sensor). Wire it up, run the Analog Read Serial Example to see what kinds of analog readings you're getting so you can set your thresholds.

Then just write a little test-program to make sure you can control the LEDs. Maybe start with the Blink Example and just blink one LED/color. Then blink a different color, etc., so you know the LEDs are working and you know that you can control them.

Then you can make a program with an [u]if-statement[/u] that turns on (or off) when the analog reading is above/below a certain threshold.

Add a couple more if-statements and you're done!