Color Input
COLORINPUT provides interfaces to an I2C-connected Color Input sensor.
Add Input Device
Item |
Description |
|||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Color Input |
Provides interfaces to an I2C-connected Color Input sensor. The bb_port pin is used in addition to the I2C port to control the LED on the color sensor.
The numbers represent the colors per the following mapping: 1: Red 2: Green 3: Blue 4: Cyan 5: Magenta 6: Yellow 7: Black 8: White 9: Gray
|
CE products: from colorinp import *
TI-Nspire CX II: from ti_hub import *
|
|
|
The function to create the object is pasted from the menu.
var=color_input("bb_port")
Command: |
var=color_input("bb_port") |
---|---|
Command |
var=color_input("bb_port") |
Python |
TI Nspire CX II: from ti_hub import * c1 = color_input("BB 2") value = c1.color_number() if (value == 1):
else:
|
|
CE products: from colorinp import * c1 = color_input("BB 2") value = c1.color_number() if (value == 1):
else:
|
Range: |
|
Describe: |
Creates an object for the color_input sensor. The sensor is attached to the I2C port and the “bb_port” is the pin on the breadboard port for the pin to control the LED in the sensor. |
Result: |
|
Type or |
Control |
var.color_number()
Command: |
var.color_number() |
---|---|
Command |
var.color_number() |
Range: |
|
Describe: |
Returns the a value between 1 – 9 from the color sensor. 1 – red 2 – green 3 – blue 4 – cyan 5 – magenta 6 - yello 7 – black 8 - white 9 – gray |
Result: |
|
Type or |
Control |
var.red()
Command: |
var.red() |
---|---|
Command |
var.red() |
Range: |
|
Describe: |
Returns a value between 0 and 255 representing the “red” component of the color under the sensor. |
Result: |
|
Type or |
Control |
var.green()
Command: |
var.green() |
---|---|
Command |
var.green() |
Range: |
|
Describe: |
Returns a value between 0 and 255 representing the “green” component of the color under the sensor. |
Result: |
|
Type or |
Control |
var.blue()
Command: |
var.blue() |
---|---|
Command |
var.blue() |
Range: |
|
Describe: |
Returns a value between 0 and 255 representing the “blue” component of the color under the sensor. |
Result: |
|
Type or |
Control |
var.gray()
Command: |
var.gray() |
---|---|
Command |
var.gray() |
Range: |
|
Describe: |
Returns a value between 0 and 255 representing the “gray component of the color under the sensor. |
Result: |
|
Type or |
Control |