Description

These are sensors used to measure distance using IR radiation. These sensors made by Sharp, more commonly referred to as just Sharp sensors, have the same functionality as SONAR sensors which however use sound waves for distance measurement.

Block description

This block can be used in analog mode to receive inputs (in cm) from a Sharp sensor connected to any of the ports S1, S2, S3.
The supported models are: Sharp GP2Y0A02YK0F, GP2Y0A21YK, GP2Y0A710K0F, GP2YA41SK0F.

Hardware interface

Connecting an external Sharp sensor

These sensors have the pin layout as shown:
Sharp Hw 1
Thus, care must be taken to match the polarities while connecting them to the Cloudio board.
Sharp Hw 2

App interface and usage

Sensor type:

Here, you can press and scroll the sensor type to select 1 of the 4 supported Sharp sensor variants.
Sharp 1

Port:

Here, you can select the port the sensor is selected to - S1/S2/S3.
Sharp 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.
Sharp Op

Value:

You can set a threshold integer value in the range 0 to 999 for comparison.
Sharp 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.

Example

This code snippet turns the LED green if the reading of the sensor is less than 200 cm and turns the buzzer on the reading touches or crosses this threshold value.
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.
Sharp Ex

Also read

Input
Control