# node-poweredup Class: TechnicColorSensor

# Class: TechnicColorSensor

## TechnicColorSensor

#### new TechnicColorSensor()

  Source:
    - devices/techniccolorsensor.js, line 25

### Extends

- Device

### Members

#### <readonly> connected

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `connected` | boolean | Check if the device is still attached.

  Inherited From:
    - Device#connected
  Source:
    - devices/device.js, line 75

#### <readonly> hub

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `hub` | Hub | The Hub the device is attached to.

  Inherited From:
    - Device#hub
  Source:
    - devices/device.js, line 82

#### <readonly> isVirtualPort

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `isVirtualPort` | boolean | Is this device attached to a virtual port (ie. a combined device)

  Inherited From:
    - Device#isVirtualPort
  Source:
    - devices/device.js, line 119

#### <readonly> mode

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `mode` | number | The mode the device is currently in

  Inherited From:
    - Device#mode
  Source:
    - devices/device.js, line 109

#### <readonly> portName

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `portName` | string | The port the device is attached to.

  Inherited From:
    - Device#portName
  Source:
    - devices/device.js, line 92

#### <readonly> type

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `type` | number | The type of the device

  Inherited From:
    - Device#type
  Source:
    - devices/device.js, line 99

### Methods

#### setBrightness(firstSegment, secondSegment, thirdSegment)

  Set the brightness (or turn on/off) of the lights around the sensor.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `firstSegment` | number | First light segment. 0-100 brightness.
  `secondSegment` | number | Second light segment. 0-100 brightness.
  `thirdSegment` | number | Third light segment. 0-100 brightness.

  Source:
    - devices/techniccolorsensor.js, line 70

  ##### Returns:

  Resolved upon successful issuance of the command.

  Type
    Promise

### Events

#### ambient

  Emits when the ambient light changes.

  ##### Type: object

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `ambient` | number | Percentage, from 0 to 100.

  Source:
    - devices/techniccolorsensor.js, line 60

#### color

  Emits when a color sensor is activated.

  ##### Type: object

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `color` | Color |

  Source:
    - devices/techniccolorsensor.js, line 39

#### reflect

  Emits when the light reflectivity changes.

  ##### Type: object

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `reflect` | number | Percentage, from 0 to 100.

  Source:
    - devices/techniccolorsensor.js, line 50

#### Search results