Inicio » Example 3

Example 3

With this program, the values measured by a light sensor (LDR) are read and shown through the Serial Monitor (of Tinkercad or the Arduino IDE). This program can also be used with other kinds of sensor (tempeature, humidity…)

int measure=0;

void setup(){

Serial.begin(9600);
pinMode(A2, INPUT);

}

void loop(){

measure=analogRead(A2);
Serial.println(measure);

}