When to Use
User wants to read light intensity (lux) from USB-connected light sensor or check ambient light levels.
Core Rules
-
Verify Hardware First — Confirm sensor is at
/dev/ttyUSB0and user is indialoutgroup. -
Always Initialize — Call
sensor.connect()before reading. Waits 1s for warmup. -
Use Filtered Data —
read_lux()returns 5-sample moving average. Useread_raw()for unfiltered values. -
Default Thresholds — Dark: < 100 lux, Bright: > 500 lux. Adjust based on environment.
-
Disconnect on Exit — Always call
sensor.disconnect()to release serial port.
Data Storage
No persistent storage. Sensor data read in real-time from serial port.
External Endpoints
| Endpoint | Purpose |
|---|---|
/dev/ttyUSB0 | Serial read |
Quick Reference
| Topic | File |
|---|---|
| Setup & examples | setup.md |
| Troubleshooting | setup.md |
Security Notes
- Declares external hardware dependency (USB sensor)
- No network access or environment variables required