I need Help white my Light sensor

Hello I have a problem with my Arduino Uno and a light sensor.

I have connected a light sensor to my Arduino Uno with I2C and would now like to output the value measured by the light sensor to my serial. Now my question Could you please tell me how I have to rewrite the code so that I get an output or tell me straight away what I am doing wrong.
Thanks for your help

The Code is here

// demo of Starter kit V2.0 - Grove - Light Sensor
// when the value of light sensor ledd than a certain value
// led will on, you can set this certain value via change thresholdvalue
// such as when you cover light sensor with your hand, you'll find led on

const int pinLight = A0;
const int pinLed = 7;

int thresholdvalue=400; //the threshold to turn on or off the LED

void setup()
{
pinMode(pinLed, OUTPUT); //set the LED on Digital 12 as an OUTPUT
}

void loop()
{
int sensorValue = analogRead(pinLight); //the light sensor is attached to analog 0

    Serial.println(thresholdvalue);

}

Hint: what is your serial line speed?

So why doesn't your code reflect that?

1 Like

my seial speed is 9600baud and he refelct it in pin Light =A0

Are you sure about that?
Did you tell everyone involved?

What I meant was "your code has no I2C handling in it, so how do you expect to read the I2C device you say you have?"

Yes im sure and if I change the code i get 400 in my Serial Monitor and I2C is an plug system and a comunication Protocoll he is conected to A0

Your sketch isn't sure.

ok but can you help me

I don't know.
You haven't posted which sensor you're using, how it is connected, or explained how the code you have posted so far is supposed to work.

ok wait 20mins

wait i make a new topic

I have the anser found

Can you please share your solution so other people who may read this thread might understand?

Then you're running some code you haven't posted.

{taps fingers impatiently}

so finaly i have fix the Problem
Code :
const int pinLight = A0;n // Value of the Light Sensor
int sensorValue; // Value of the Serial Monitor

void setup()
{
Serial.begin(9600);
}

void loop()
{
sensorValue = analogRead(A0);
Serial.println(sensorValue);
delay(3600);

}

You create an identifier 'pinLight' for the analog input, then you throw it in the trash bin.