{"id":19156870,"url":"https://github.com/bertrandmartel/opc-java","last_synced_at":"2025-09-09T03:32:28.390Z","repository":{"id":94808658,"uuid":"66986712","full_name":"bertrandmartel/opc-java","owner":"bertrandmartel","description":"Fork of Open Pixel Control library for Java/Android from https://github.com/scanlime/fadecandy/tree/master/examples/java","archived":false,"fork":false,"pushed_at":"2017-01-12T14:45:58.000Z","size":85,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-11-09T08:42:40.481Z","etag":null,"topics":["fadecandy","java-library"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bertrandmartel.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-08-31T00:06:14.000Z","updated_at":"2024-02-23T21:11:19.000Z","dependencies_parsed_at":"2023-03-11T18:30:52.031Z","dependency_job_id":null,"html_url":"https://github.com/bertrandmartel/opc-java","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bertrandmartel%2Fopc-java","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bertrandmartel%2Fopc-java/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bertrandmartel%2Fopc-java/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bertrandmartel%2Fopc-java/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bertrandmartel","download_url":"https://codeload.github.com/bertrandmartel/opc-java/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":232388932,"owners_count":18515734,"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":["fadecandy","java-library"],"created_at":"2024-11-09T08:36:13.353Z","updated_at":"2025-01-03T20:11:42.998Z","avatar_url":"https://github.com/bertrandmartel.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Open Pixel Control Library \n\n[![Build Status](https://travis-ci.org/bertrandmartel/opc-java.svg?branch=master)](https://travis-ci.org/bertrandmartel/opc-java)\n[ ![Download](https://api.bintray.com/packages/bertrandmartel/maven/opc-java/images/download.svg) ](https://bintray.com/bertrandmartel/maven/opc-java/_latestVersion)\n[![Maven Central](https://maven-badges.herokuapp.com/maven-central/fr.bmartel/opc/badge.svg)](https://maven-badges.herokuapp.com/maven-central/fr.bmartel/opc)\n[![Javadoc](http://javadoc-badge.appspot.com/fr.bmartel/opc.svg?label=javadoc)](http://javadoc-badge.appspot.com/fr.bmartel/opc)\n[![License](http://img.shields.io/:license-mit-blue.svg)](LICENSE.md)\n\nOpen Pixel Control Library for Java/Android forked from https://github.com/scanlime/fadecandy/tree/master/examples/java\n\n\u003chr/\u003e\n\n## Include in your project\n\n* with Gradle, from jcenter :\n\n```\ncompile 'fr.bmartel:opc:1.08'\n```\n\n## Description\n\nSimple Java OPC client for the [Fadecandy](http://www.misc.name/fadecandy/).\nThis is an alternative to the Processing client, providing a simpler interface similar to Adafruit's [NeoPixel library for Arduino](https://github.com/adafruit/Adafruit_NeoPixel).\n\n## Writing simple pixel programs\n\nHere is a simple Java program that will color some of the lights:\n\n```\n    public static void main(String[] args) throws Exception {\n        OpcClient server = new OpcClient(\"10.28.46.61\", 7890);\n        OpcDevice fadecandy = server.addDevice();\n        PixelStrip strip = fadecandy.addPixelStrip(0, 64);\n        \n        int color = 0xFF0000;  // red\n        strip.setPixelColor(3, color);\n        strip.setPixelColor(5, 0x888800); // yellow\n        strip.setPixelColor(7, 0x00FF00); // green\n        \n        server.show();        // Display the pixel changes\n        Thread.sleep(5000);   // Wait five seconds\n        server.clear();       // Set all pixels to black\n        server.show();        // Show the darkened pixels\n        \n        server.close();\n    }\n```\n\n## Animations\nWe can also create Animation classes which will draw different patterns over and over.  We can attach animations to any given pixel strip.  When we attach a new animation object, the light patterns will change.\n\n```\npublic class RandomPixels extends Animation {\n\n    java.util.Random rand;\n    \n    public void reset(PixelStrip strip) {\n        rand = new java.util.Random();\n    }\n\n    public boolean draw(PixelStrip strip) {\n        int randomPixel = rand.nextInt(strip.getPixelCount());\n        int randomColor = makeColor(rand.nextInt(255), \n                         rand.nextInt(255), rand.nextInt(255));\n        strip.setPixelColor(randomPixel, randomColor);\n        return true;\n    }\n}\n```\n\n## Server Configuration\n\nThe Fadecandy has eight pins, each of which can control a strip of 64 pixels.\nIf you have contiguous strips of pixels starting on pin zero, then your `fc_server` won't need to map the output pixels numbers to configurable OPC numbers.  However, if you have\nshorter strips connected to different pins, you may want to set up a [JSON configuration file](https://github.com/scanlime/fadecandy/blob/master/doc/fc_server_config.md)\nfor the server.  The `OpcClient` class can print out a JSON configuration based on\nstrip definitions:\n\n```\npublic static void main(String[] arg)  {\n    OpcClient server = new OpcClient(\"raspberrypi.local\", 7980);\n    OpcDevice fadeCandy = server.addDevice();\n        \n    PixelStrip strip1 = fadeCandy.addPixelStrip(0, 64);  // 8 x 8 grid on pin 0\n    PixelStrip strip2 = fadeCandy.addPixelStrip(1, 8);   // 8 pixel strip on pin 1\n    PixelStrip strip3 = fadeCandy.addPixelStrip(2, 16);  // 16 pixel ring on pin 2\n    PixelStrip strip4 = fadeCandy.addPixelStrip(3, 24);  // The first 24 pixels on pin 3\n    PixelStrip strip5 = fadeCandy.addPixelStrip(3, 17);  // The next 17 pixels on pin 3\n        \n    // Since the pixels are not uniform strips of 64, customize \n    // the server config JSON file with the following:\n    System.out.println(server.getConfig());\n}\n```\n\nFor the above setup, the JSON server configuration should be:\n\n```\n{\n    \"listen\": [ \"raspberrypi.local\", 7890],\n    \"verbose\": true,\n    \"devices\": [\n        {\n            \"type\": \"fadecandy\",\n            \"map\": [\n\n                    [0, 0, 0, 64 ],\n                    [0, 64, 64, 8 ],\n                    [0, 72, 128, 16 ],\n                    [0, 88, 192, 24 ],\n                    [0, 112, 216, 17 ]\n                ]\n        }   ]\n}\n```\n\n## Examples\n\n\n* Example animation that pulses all pixels through an array of colors\n\n```\n./gradlew pulsing\n```\n\n* Display a moving white pixel with trailing orange/red flames. This looks pretty good with a ring of pixels.\n\n```\n./gradlew spark\n```\n\n* Pairs of lights traveling down the strip.\n\n```\n./gradlew theaterLights\n```\n\n## Build\n\nGradle using IntelliJ IDEA or Eclipse\n\n## License\n\n```\nThe MIT License (MIT)\n\nCopyright for portions of project opc-java are held by Micah Elizabeth Scott, 2013 \nas part of project Fadecandy. \nAll other copyright for project opc-java are held by Bertrand Martel, 2016.\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of\nthis software and associated documentation files (the \"Software\"), to deal in\nthe Software without restriction, including without limitation the rights to\nuse, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\nthe Software, and to permit persons to whom the Software is furnished to do so,\nsubject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\nFOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\nCOPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\nIN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\nCONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbertrandmartel%2Fopc-java","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbertrandmartel%2Fopc-java","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbertrandmartel%2Fopc-java/lists"}