{"_id":"5a6e8a7640065a00127f6adc","project":"5581248904ae5b0d0026289a","version":{"_id":"57fdb17c4defec0e0064228b","project":"5581248904ae5b0d0026289a","__v":2,"createdAt":"2016-10-12T03:43:56.009Z","releaseDate":"2016-10-12T03:43:56.009Z","categories":["57fdb17c4defec0e0064228c","57fdb17c4defec0e0064228d","57fdb17c4defec0e0064228e","57fdb520bcc07b0e00d1ef41"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"2.0.0","version":"2.0"},"category":{"_id":"57fdb520bcc07b0e00d1ef41","__v":0,"project":"5581248904ae5b0d0026289a","version":"57fdb17c4defec0e0064228b","sync":{"url":"","isSync":false},"reference":false,"createdAt":"2016-10-12T03:59:28.475Z","from_sync":false,"order":1,"slug":"guides","title":"Guides"},"user":"557e2561eb75d80d00af3dab","githubsync":"","__v":0,"parentDoc":null,"updates":[],"next":{"pages":[],"description":""},"createdAt":"2018-01-29T02:44:06.851Z","link_external":false,"link_url":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":5,"body":"[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/bf282a5-LIFX-Tile.jpg\",\n        \"LIFX-Tile.jpg\",\n        1460,\n        1014,\n        \"#a9c3c6\"\n      ]\n    }\n  ]\n}\n[/block]\nLIFX Tiles are square devices containing 64 individually controllable LEDs. These devices are also special in that you can join up to 5 of them in a chain which then behaves like a single device. The tile closest to the power supply will be the master tile and is the one you send messages to for control of any tile in the chain.\n[block:callout]\n{\n  \"type\": \"info\",\n  \"title\": \"Backwards Compatibility\",\n  \"body\": \"When not using the [Tile Messages](doc:tile-messages) the whole chain is controlled. For example if you send a [SetColor](doc:light-messages#section-setcolor-102) message to a tile, all the tiles in the chain will change to the chosen color. This means applications that already support the current protocol do not need to make any changes to support controlling all the tiles at once.\"\n}\n[/block]\n## Individual Tile Control\n\nTiles can be controlled individually using the `tile_index` and `length` properties for the [Tile Messages](doc:tile-messages). Tiles are indexed with the master tile being represented with zero, and increasing by one for each tile after. When addressing tiles the `tile_index` represents the first tile that should process the command, and the `length` value represents how many tiles should process the command beginning with the tile specified in `tile_index` and continuing to the tiles immediately following that one.\n\nThe following diagrams illustrate the use of `tile_index` and `length` parameters.\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/3978886-applications2.png\",\n        \"applications2.png\",\n        1135,\n        409,\n        \"#5cc9f7\"\n      ],\n      \"caption\": \"A message with a `tile_index` of 0 and `length` of 1 will only be processed by the master tile.\"\n    }\n  ]\n}\n[/block]\n\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/4817cc0-application.png\",\n        \"application.png\",\n        1135,\n        409,\n        \"#fa7171\"\n      ],\n      \"caption\": \"A message with `tile_index` of 1, and a `length` of 2 would affect the tile after the master tile, and the tile after that.\"\n    }\n  ]\n}\n[/block]\n## Tile Positioning\n\nThe `user_x` and `user_y` fields contain positioning information for each tile. Each tile is positioned in a 2D space. The point represents the location of the center of the tile and the unit of measurement is one tile width. So if you have 3 tiles in a chain with `user_x` and `user_y` of (0, 0), (-0.5, 1) and (0.5, -1) then you'd have something like:\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/dec71da-coords.png\",\n        \"coords.png\",\n        462,\n        685,\n        \"#5ccbfa\"\n      ]\n    }\n  ]\n}\n[/block]\nThese position values are stored in the tile and are meant to be used by client applications in order to locate the tiles on a 2D plane. This can then be used to apply images across the set of tiles, or match up the borders of a tile when displaying a pattern.","excerpt":"","slug":"tile-control","type":"basic","title":"Tile Control"}
[block:image] { "images": [ { "image": [ "https://files.readme.io/bf282a5-LIFX-Tile.jpg", "LIFX-Tile.jpg", 1460, 1014, "#a9c3c6" ] } ] } [/block] LIFX Tiles are square devices containing 64 individually controllable LEDs. These devices are also special in that you can join up to 5 of them in a chain which then behaves like a single device. The tile closest to the power supply will be the master tile and is the one you send messages to for control of any tile in the chain. [block:callout] { "type": "info", "title": "Backwards Compatibility", "body": "When not using the [Tile Messages](doc:tile-messages) the whole chain is controlled. For example if you send a [SetColor](doc:light-messages#section-setcolor-102) message to a tile, all the tiles in the chain will change to the chosen color. This means applications that already support the current protocol do not need to make any changes to support controlling all the tiles at once." } [/block] ## Individual Tile Control Tiles can be controlled individually using the `tile_index` and `length` properties for the [Tile Messages](doc:tile-messages). Tiles are indexed with the master tile being represented with zero, and increasing by one for each tile after. When addressing tiles the `tile_index` represents the first tile that should process the command, and the `length` value represents how many tiles should process the command beginning with the tile specified in `tile_index` and continuing to the tiles immediately following that one. The following diagrams illustrate the use of `tile_index` and `length` parameters. [block:image] { "images": [ { "image": [ "https://files.readme.io/3978886-applications2.png", "applications2.png", 1135, 409, "#5cc9f7" ], "caption": "A message with a `tile_index` of 0 and `length` of 1 will only be processed by the master tile." } ] } [/block] [block:image] { "images": [ { "image": [ "https://files.readme.io/4817cc0-application.png", "application.png", 1135, 409, "#fa7171" ], "caption": "A message with `tile_index` of 1, and a `length` of 2 would affect the tile after the master tile, and the tile after that." } ] } [/block] ## Tile Positioning The `user_x` and `user_y` fields contain positioning information for each tile. Each tile is positioned in a 2D space. The point represents the location of the center of the tile and the unit of measurement is one tile width. So if you have 3 tiles in a chain with `user_x` and `user_y` of (0, 0), (-0.5, 1) and (0.5, -1) then you'd have something like: [block:image] { "images": [ { "image": [ "https://files.readme.io/dec71da-coords.png", "coords.png", 462, 685, "#5ccbfa" ] } ] } [/block] These position values are stored in the tile and are meant to be used by client applications in order to locate the tiles on a 2D plane. This can then be used to apply images across the set of tiles, or match up the borders of a tile when displaying a pattern.