Light Sensor in Python

Intermediate

Read the PT19 phototransistor with `pybot.light()` and map the 0–100 value to LED brightness. Watch the LEDs respond in real time as the room lighting changes.

20 min5 steps
Light SensorPT19ADCMappingLEDIntermediate
0 of 5 steps

Step 1 of 5

Connect your board

Power on your Beaver Board — the OLED will show a PIN code. Click Connect in the toolbar, choose Connect via Bluetooth, and select your board. If it's your first time, enter the PIN shown on the screen.

The PT19 light sensor is built into the board on GP26 — no extra wiring needed.