Sample to use on pin to trigger the IR sensor detects an object. This is event-driven mode, Micro:bit will capture all trigger change and execute them one by one.
Legacy reading the sensor’s status using procedural coding, the sensor cannot be triggered by Micro:bit under high-speed detection.