Circuit Troubles

Grumpy_Mike:

can phototransistors also be known as resistors

No a photo transistor and resistor are two different thing. Also a photo transistor and a photo resistor are two very different things.

Okay, thank you for that explanation :).

Grumpy_Mike:

is there anything particularly wrong with the code?

Yes the photo transistor is never read, that line is commented out.

I have been thinking about this and your best bet is to swap the resistor and photo transistor round like I said. Use a 100K resistor and connect it to an analogue input, say A0.
Then read it with a line
eye = analogRead(0); // set eye to the light value we "see"
Serial.println(eye); // look at the value
Then try it and look at the range of numbers you get when you cover the light. Pick a number in the middle of this range and assign it to a variable call threshold at the start of your code. For example if 200 is the middle number you would put:-
int threshold = 200; Then remove the Serial.println(eye); line.
Just before the void setup();
Then change the line:-
if (eye) {
to
if ( eye < threshold ) {

So, from my understanding of your posts, I will need to produce one of the following circuits? Please excuse the crude drawings! :slight_smile:

(Version 4)

(Version 5)

Please note that on the Version 4 drawing, the positive from the RGB LED is to go to the positive on the LiPo board (left-most board).