Table of Contents

Function Definition: readirsensor(sensor = "IRL")

Parameters

NameTypeDescriptionExpected ValuesDefault Value
sensorstringThe specific IR sensor."IRL" or "IRR""IRL"

Description

The function returns the IR sensor analog reading. The reading varies from 0 to 4095.

 

Let us understand the IR Sensors. An infrared (IR) sensor is an electronic device that measures and detects infrared radiation in its surrounding environment. IR is invisible to the human eye.

Quarky has 2 IR sensors.

PET1

Let’s understand how they work.

An IR sensor consists of 2 LEDs: one which transmits the IR light and one which receives the IR light. When the IR rays are transmitted, they bounce from the nearest surface and get back to the receiver LED. That’s how an IR sensor detects an object.

PET1 (2)

We can get the sensor values in PictoBlox based on that value. We can estimate whether there is an obstacle.

  1. If the sensor detects nothing, its output value is increased. This means that the sensor is active.
  2. If it detects an obstacle, its output value decreases. This means that the sensor is inactive.

evive Alert
IR sensors DON’T work in sunlight. IR rays from the sun increase the overall threshold of the sensors; therefore they stay active all time. A closed environment or nighttime is the place/time to work with your line following robot.

Example

There are no examples documented for this article.