APIs for color sensors.
More...
|
typedef pbio_color_hsv_t | pup_color_hsv_t |
| Get the color of surface or an extra source by a color sensor. More...
|
|
APIs for color sensors.
◆ pup_color_hsv_t
Get the color of surface or an extra source by a color sensor.
By default, it detects red, yellow, green, blue, white, none. You can choose color detected by pup_detectale_colors()
- Parameters
-
pdev | PUP device pointer to be inquired. |
true | Scan from a surface. |
false | Scan from a external light sources. |
- Returns
- Color in hsv style.
◆ pup_color_sensor_ambient()
Get the ambient light intensity.
- Parameters
-
pdev | PUP device pointer to be inquired. |
- Returns
- Ambient light intensity in percentage style.
◆ pup_color_sensor_detectable_colors()
Configure colors which color sensor should detect.
- Parameters
-
size | Size of the colors array. |
colors | Array of colors. |
- Return values
-
◆ pup_color_sensor_get_device()
pup_device_t * pup_color_sensor_get_device |
( |
pbio_port_id_t |
port | ) |
|
Get the PUP device pointer of the color sensor specified with the port ID.
If it fails, it outputs an error log and returns NULL.
- Parameters
-
port | PUP port ID to be inquired. |
- Returns
- pdev PUP device pointer.
◆ pup_color_sensor_hsv()
Get the color of surface or an extra source by a color sensor.
Unlike pup_color_sensor_color(), it gives the hsv detected directly, instead of rounding it to the nearest detectable colors.
- Parameters
-
pdev | PUP device pointer to be inquired. |
true | Scan from a surface. |
false | Scan from a external light sources. |
- Returns
- Color in hsv style.
◆ pup_color_sensor_light_off()
pbio_error_t pup_color_sensor_light_off |
( |
pup_device_t * |
pdev | ) |
|
Set the three light brightneses of the color sensor.
Same as pup_color_sensor_light_set(pdev, 0, 0, 0)
- Parameters
-
- Return values
-
◆ pup_color_sensor_light_on()
pbio_error_t pup_color_sensor_light_on |
( |
pup_device_t * |
pdev | ) |
|
Set the three light brightneses of the color sensor.
Same as pup_color_sensor_light_set(pdev, 100, 100, 100)
- Parameters
-
- Return values
-
◆ pup_color_sensor_light_set()
pbio_error_t pup_color_sensor_light_set |
( |
pup_device_t * |
pdev, |
|
|
int32_t |
bv1, |
|
|
int32_t |
bv2, |
|
|
int32_t |
bv3 |
|
) |
| |
Set the three light brightneses of the color sensor.
- Parameters
-
pdev | PUP device pointer. |
bv1 | Brightness. |
- Return values
-
◆ pup_color_sensor_reflection()
Get the percentage of how much a surface reflects the light emmited by the sensor.
- Parameters
-
pdev | PUP device pointer to be inquired. |
- Returns
- Mesured reflection in percentage style.