0Pricing
Arduino & IoT Academy · Aula

Meça a luz com um LDR

Monte um divisor de tensão para ler o brilho.

Meça a luz com um LDR é uma aula grátis de Arduino & IoT Academy no CoddyKit. Esta é a aula 2 de 4. Você pode ler a aula completa abaixo gratuitamente — depois pratica ao vivo no navegador com um editor de código integrado e um tutor de IA 24/7. Faz parte do caminho de aprendizado de Arduino & IoT Academy, e seu progresso é sincronizado entre a web e o app CoddyKit. O curso de Arduino & IoT Academy inclui 4 aulas no total.

Partes desta aula ainda não foram traduzidas e aparecem em inglês.

What an LDR Is

An LDR is a light-dependent resistor. Its resistance drops in bright light and climbs high in the dark.

Resistance Tracks Light

Cover an LDR and its resistance soars; shine a lamp on it and resistance falls. That change is what you measure.

It Cannot Be Read Alone

The Arduino reads voltage, not resistance. So an LDR by itself gives no voltage the board can sense directly.

Pair It With a Resistor

Combine the LDR with a fixed resistor to form a voltage divider. Together they turn light into a readable voltage.

Pick a 10k Partner

A 10k ohm resistor is a solid default partner for most LDRs. It keeps your readings spread across a useful range.

Tap the Middle Point

Connect the junction between the LDR and the resistor to an analog pin like A0. That midpoint voltage is your signal.

Read the Brightness

Call analogRead on the divider pin to get a 0 to 1023 number that rises and falls with the light.

int light = analogRead(A0);

Wiring Sets Direction

Which side the LDR sits on decides whether bright gives a high or low number. Test it and note your result.

Watch It Live

Print the value so you can wave your hand over the sensor and see the number react with Serial.println.

Serial.println(analogRead(A0));

Smooth Out Flicker

Lights flicker faster than your eye sees. Averaging a few readings gives a steadier brightness value.

A Cheap, Useful Sensor

The LDR is a cheap way to add light awareness. It powers night lights, plant monitors, and auto-dimming displays.

Quick Check

Why cant an LDR connect to an analog pin on its own?

Recap: Reading Light

You built an LDR voltage divider with a 10k resistor, tapped the midpoint to A0, and read brightness with analogRead.

Perguntas Frequentes

A aula “Meça a luz com um LDR” é grátis?

Sim — o texto completo de “Meça a luz com um LDR” é grátis para ler aqui na web. Para praticá-la interativamente (um editor de código integrado e um tutor de IA 24/7) e desbloquear o restante do curso de Arduino & IoT Academy, atualize para CoddyKit PRO. O curso de Arduino & IoT Academy inclui 4 aulas no total.

O que vou aprender em “Meça a luz com um LDR”?

Monte um divisor de tensão para ler o brilho. Você pratica Arduino & IoT Academy com código prático que executa diretamente no navegador, e um tutor de IA 24/7 responde suas dúvidas enquanto trabalha na aula.

Preciso ter experiência prévia para começar Arduino & IoT Academy?

Nenhuma experiência prévia é necessária. Arduino & IoT Academy no CoddyKit é estruturado para alunos iniciantes até avançados, então você pode começar aqui ou desde o início e aprender no seu ritmo. Esta é a aula 2 de 4.

Quanto tempo leva a aula “Meça a luz com um LDR”?

A maioria das aulas CoddyKit leva cerca de 5–10 minutos. Cada uma é compacta e interativa, então você faz progresso constante e retoma exatamente de onde parou entre web e app.

Posso escrever e executar código nesta aula de Arduino & IoT Academy?

Sim. Cada aula de Arduino & IoT Academy inclui um editor de código integrado, então você escreve e executa código real direto no navegador e recebe feedback de IA instantaneamente — nenhuma configuração local necessária.

Todas as aulas deste curso

  1. Leia um sensor de movimento PIR
  2. Meça a luz com um LDR
  3. Defina um limiar de luz
  4. Luz noturna automática
← Voltar para Arduino & IoT Academy