{"id":13481049,"url":"https://github.com/Nilhcem/ledcontrol-androidthings","last_synced_at":"2025-03-27T11:31:37.327Z","repository":{"id":141783953,"uuid":"86193501","full_name":"Nilhcem/ledcontrol-androidthings","owner":"Nilhcem","description":"Android Things Port of the Arduino LedControl library for the MAX7219 LED matrix module","archived":false,"fork":false,"pushed_at":"2018-05-10T13:51:58.000Z","size":1749,"stargazers_count":19,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-10-30T14:43:11.854Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Nilhcem.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2017-03-25T22:50:36.000Z","updated_at":"2019-01-12T00:14:10.000Z","dependencies_parsed_at":"2023-03-17T05:15:39.257Z","dependency_job_id":null,"html_url":"https://github.com/Nilhcem/ledcontrol-androidthings","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Nilhcem%2Fledcontrol-androidthings","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Nilhcem%2Fledcontrol-androidthings/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Nilhcem%2Fledcontrol-androidthings/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Nilhcem%2Fledcontrol-androidthings/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Nilhcem","download_url":"https://codeload.github.com/Nilhcem/ledcontrol-androidthings/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245836180,"owners_count":20680330,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-31T17:00:48.100Z","updated_at":"2025-03-27T11:31:36.864Z","avatar_url":"https://github.com/Nilhcem.png","language":"Java","funding_links":[],"categories":["Useful links"],"sub_categories":["Drivers"],"readme":"# MAX7219 / MAX7221 driver for Android Things\n\nA port of the LedControl Arduino library for Android Things.\n\n![photo][]\n\n## Download\n\n```groovy\ndependencies {\n    compile 'com.nilhcem.androidthings:driver-max72xx:0.0.3'\n}\n```\n\n## Usage\n\n### Setup\n\n```java\ntry {\n    ledControl = new LedControl(\"SPI0.0\", 1); // second parameter is the number of chained matrices. Here, we only use 1 LED matrix module (8x8).\n    for (int i = 0; i \u003c ledControl.getDeviceCount(); i++) {\n        ledControl.setIntensity(i, 3);\n        ledControl.shutdown(i, false);\n        ledControl.clearDisplay(i);\n    }\n} catch (IOException e) {\n    Log.e(TAG, \"Error initializing LED matrix\", e);\n}\n// Don't forget to call ledControl.close() when you are done.\n```\n\n\n### Turn on one pixel on matrix #0 at {row:2, col:3}\n\n```java\nledControl.setLed(0, 2, 3, true);\n```\n\n\n### Show a bitmap on matrix #0\n\n```java\nBitmap bmp = BitmapFactory.decodeResource(getResources(), R.drawable.smiley);\nledControl.draw(0, bmp);\n```\n\n\n### Draw a single bitmap on multiple devices\n```java\n// Here, we're drawing a [width=32, height=8] bitmap on a \"4 in 1\" display module\nBitmap bmp = BitmapFactory.decodeResource(getResources(), R.drawable.hearts32x8);\nledControl.draw(bmp);\n```\n\n\n### Show \"42.ABCDEF\" on a MAX7219 8-digit module\n\n```java\nledControl.setDigit(0, 7, (byte) 0x04, false);\nledControl.setDigit(0, 6, (byte) 0x02, true);\nledControl.setDigit(0, 5, (byte) 0x0A, false);\nledControl.setDigit(0, 4, (byte) 0x0B, false);\nledControl.setDigit(0, 3, (byte) 0x0C, false);\nledControl.setDigit(0, 2, (byte) 0x0D, false);\nledControl.setDigit(0, 1, (byte) 0x0E, false);\nledControl.setDigit(0, 0, (byte) 0x0F, false);\n```\n\n\n### Show \"123456\" on a MAX7219 8-digit module\n\n```java\nint curValue = 123456;\nfor (int i = 0; i \u003c 8; i++) {\n    byte value = (byte) ((i != 0 \u0026\u0026 curValue == 0) ? 16 : (curValue % 10));\n    ledControl.setDigit(0, i, value, false);\n    curValue /= 10;\n}\n```\n\n\n## Schematic\n\n![schematic][]\n\n\nCredits to [https://learn.adafruit.com/trinket-slash-gemma-space-invader-pendant/animation][invaders] for the Space invaders animation, [http://wdi.supelec.fr/boulanger/MicroPython/][fritzing] for the fritzing part.\n\n[photo]: https://raw.githubusercontent.com/Nilhcem/ledcontrol-androidthings/master/assets/preview.gif\n[schematic]: https://raw.githubusercontent.com/Nilhcem/ledcontrol-androidthings/master/assets/schematic.png\n[invaders]: https://learn.adafruit.com/trinket-slash-gemma-space-invader-pendant/animation\n[fritzing]: http://wdi.supelec.fr/boulanger/MicroPython/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FNilhcem%2Fledcontrol-androidthings","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FNilhcem%2Fledcontrol-androidthings","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FNilhcem%2Fledcontrol-androidthings/lists"}