-
Notifications
You must be signed in to change notification settings - Fork 2
Prox
Kravitz Lab edited this page Jan 26, 2026
·
1 revision
The FED4 uses a VL53L1X time-of-flight (ToF) distance sensor on the primary I2C bus (XSHUT on MCP pin 1). Measures approach distance to the nose port.
API
-
initializeToF()— init ToF sensor (called frombegin()). Returnstrueon success. -
prox()— take a single distance reading. Returns distance in mm (0–150), or-1on error/timeout.
Details
- Raw reading is offset by a 20 mm calibration (configurable in code). Values < 0 are clamped to 0; > 150 mm are capped at 150.
- Used for approach detection (e.g. Pavlovian_Prox) and to exercise the primary I2C bus before secondary use (e.g. in
pollSensors()).
See FED4_Prox.cpp. Hardware: SparkFun VL53L1X, SparkFun Arduino library.