Table of Contents

Get Sensor Readings

Get Sensor Readings

Description

This Boolean block checks whether the selected infrared sensor detects the line and returns True or False.

The dropdown allows users to select any of the five sensors.

Sensor Position
IR-L Leftmost
IR-SL Slightly Left
IR-C Centre
IR-SR Slightly Right
IR-R Rightmost

How It Works

The block reads the sensor states through the I2C interface and returns the state of the selected sensor.

  • True: The selected sensor detects the line.
  • False: The selected sensor does not detect the line.

For example, selecting IR-C checks whether the centre sensor detects the line beneath the robot.

This block is useful for creating custom conditions, detecting line positions, and controlling robot movement based on individual sensor readings.

Python Function – Quarky and Quarky Intellio:

lf5ir.getirstate(“center”)

Other sensor selections include:

lf5ir.getirstate(“left”)

lf5ir.getirstate(“slight_left”)

lf5ir.getirstate(“slight_right”)

lf5ir.getirstate(“right”)

Example

There are no examples documented for this article.