Description

A Light Sensor generates an output signal indicating the intensity of light by measuring the radiant energy in the light spectrum. It is a passive device that convert this “light energy” into an electrical signal output.

Block description

This block can be used receive analog inputs (integer values in the range 0 to 999) from a Light sensor. The sensor can be the on-board Ambient Light sensor, or an external sensor connected to any of the ports S1, S2, S3.

Hardware interface

On-board sensor

Cloudio contains an on-board Ambient Light Sensor .
Light Hw 1

Connecting an external Light sensor

Note: While connecting an external sensor to the Cloudio board, care must be taken to match the polarities of the sensor with that of the port (S1/S2/S3) that it is being connected to.

Light Hw 2

App interface and usage

Port :

Here, you can select the port the sensor is selected to.
• LT (if you’re using the on-board sensor),
or
• S1/S2/S3 (if you’re using an external Light sensor connected to either of the 3 ports)
Light Port

Operator:

Here, you can select the operator to be used while comparing the values received from the sensor against the threshold value set in the next step.
Light Op

Value:

You can set a threshold integer value for comparison.
Light Val
You can use the Read option to read/receive real-time values from the port selected.

After you set the parameters for the block, you can press Done to confirm and save your changes.

Examples

This code snippet turns the buzzer on if the value received from the on-board Light sensor is greater than or equal to 666.

Note: This is a code snippet to explain the working of the block. In this case, this code will be executed once and at the time of uploading the code.
You will need to use this snippet inside a loop infinitely block if you want this code to run on the board for the entire duration that the board is on.
Light Ex

Also read

Input
Control