I cannot fathom what is going on.
This is what I have now for the transistor

And for the photocell

And the code
const int ledPin = 6;
const int lightPin = 0;
int luminosite;
void setup() {
pinMode(ledPin, OUTPUT);
Serial.begin(9600);
}
void loop() {
luminosite = map(analogRead(lightPin), 0, 1023, 255, 0);
// this is inversed because I want the LEDs to become brighter as light increases
analogWrite(ledPin, luminosite);
Serial.println(analogRead(lightPin));
Serial.println(luminosite);
Serial.println();
delay(200);
}
The lower the light, the lower the analog value on the photocell. And the higher the value mapped to luminosite.
So, when there is a lot of light, the luminosite should be closer to 255 and the LEDs be very bright.
When there is low light, the luminosite should be closer to 0 and the LEDs be less bright.
This is working as the values output on the serial monitor concur.
What blows my mind is that the LEDs work in reverse logic!!! If I hook one up directly to the Arduino pin, it is fine; 0 = off, 255 = full on.
But when I hook up the transistor, with the exact same code, the opposite happens!! The lower the 0-255 luminosite value, the brighter the LED!
Can anyone figure this out??