Component: Infrared Reflective Sensor (101020174) (101020174) (Grove)

From Flowcode Help
Jump to navigationJump to search


Author Matrix Ltd
Version 1.0 (Release)
Category Grove


Image Infrared Reflective Sensor (101020174) (101020174) component

Uses InfraRed light to detect if an external object is near to the sensor. Returns a digital signal which can represent detected or not detected states. The reflective sensor has a range of roughly 4-16mm.

Make sure the SIG pin is connected to the correct port in flowcode. The infrared reflective sensor must be initialised before it can take any readings. Light is emitted by an IR LED, which gets reflected by any object and that reflection is detected by a phototransistor. Light surfaces are better at reflecting the light than darker ones as dark tends to absorb the light. When reflected light is detected it produces a low signal on the SIG pin, if there is no reflection or the object is too far from the sensor, the output on the SIG pin stays at high. There is also a red LED which glows when a reflection is detected.

Examples

No additional examples


Downloadable macro reference

SampleSensor

Returns the state of the sensor pin.

Parameters

This macro has no parameters


Return value

BYTE


Initialise

Configures the I/O ready for the sensor to be sampled.

Parameters

This macro has no parameters


Return value

This call does not return a value


Simulation macro reference

This component does not contain any simulation macros


Property reference

SIG Pin

This property is of type Single digital pin and can be referenced with the variable name SIG.

Pin connected to the sensor element of the photo transistor

Sensitivity

This property is of type Unsigned integer and can be referenced with the variable name Sensitivity.

Simulation range used to determine if the sense pin is active or not.