Hardware
Some platforms support special hardware, that can be easily managed by JS using sOS hardware API.
LED
Some Philips brand devices have LED lights built into them. The color of lights can be changed or disabled:
All methods
Method | Description | Supported since |
---|---|---|
setColor() | Method supports a string in hexa format to display color of LED light or null value to not be disabled | 1.0.1 |
setColor()
Param | Type | Required | Description |
---|---|---|---|
color | string | Yes | Color of LED to be set in CSS hexa format #000000 . To disable LED pass null value instead. |
Javascript example
sos.hardware.led.setColor("#00FF00"); // For GREEN light
GitHub Example
Errors
Although we are doing our best, following errors may occur when working with the hardware.
Code | Type | Message |
---|---|---|
50601 | InternalHardwareError | Unexpected error occurred when working with hardware. |
40601 | AppletHardwareError | Color must be string |
40602 | AppletHardwareError | Color must be in format #000000 or null, allowed are /^[a-zA-Z0-9\.\-_]+$/g |