{"id":17680622,"url":"https://github.com/robacarp/bm_lights","last_synced_at":"2025-08-07T20:17:41.279Z","repository":{"id":4319083,"uuid":"5453196","full_name":"robacarp/bm_lights","owner":"robacarp","description":null,"archived":false,"fork":false,"pushed_at":"2017-10-16T15:16:37.000Z","size":11,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-05T21:35:42.996Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Arduino","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/robacarp.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-08-17T14:19:31.000Z","updated_at":"2017-10-16T15:16:39.000Z","dependencies_parsed_at":"2022-09-02T19:32:16.887Z","dependency_job_id":null,"html_url":"https://github.com/robacarp/bm_lights","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robacarp%2Fbm_lights","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robacarp%2Fbm_lights/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robacarp%2Fbm_lights/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robacarp%2Fbm_lights/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/robacarp","download_url":"https://codeload.github.com/robacarp/bm_lights/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246365645,"owners_count":20765546,"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-10-24T09:08:29.257Z","updated_at":"2025-03-30T19:12:28.566Z","avatar_url":"https://github.com/robacarp.png","language":"Arduino","funding_links":[],"categories":[],"sub_categories":[],"readme":"This is an Arduino 1.0 program for animating a series of ShiftBrite lights.  The project is for an art installation at Burning Man 2012.  Initially the project started out as a [series of pendulums](http://robacarp.github.com/burning-man-pendulum) that would each be swinging with a slightly offset period, calculated to produce striking patterns in their swing.  Due to cost and time constraints, the pendulum idea was scrapped for a series of variable length, stationary light poles.   Each pole has a [ShiftBrite Satellite](http://macetech.com/store/index.php?main_page=product_info\u0026products_id=16) module inside a diffuser globe. \n\n### Code Highlights:\n\n  - **Arduino 1.0 compatible algorithm for controlling ShiftBrites** - Available code from [Macetech](http://docs.macetech.com/doku.php/shiftbrite#code_example), the [Arduino website](http://arduino.cc/playground/Main/ShiftBriteLib), and [other resources on Github](http://code.google.com/p/shiftbritehughesyarduino/) is largely messy code, overcomplicated, with excessively verbose *and global* variable names, and... it doesn't compile anymore.  It isn't abstracted out into its own library, but the [functions are isolated into their own .ino file](https://github.com/robacarp/bm_lights/blob/master/lights.ino). for easy inclusion into other arduino projects.\n  - **Working Algorithm for converting HSB color values to RGB**  - This proved to be incredibly useful for producing good looking color transitions.  Setting color values with RGB is not conducive to simple constant brightness color changing algorithms. By altering the color space to allow for setting Hue, Saturation and Brightness independently, visual applications which slide between colors are much easier to write and understand.  [Color.h](https://github.com/robacarp/bm_lights/blob/master/color.h) contains a class definition which will transparently transcode HSB color values to RGB -- but **not** the other way. \n  - **Several simple color fading algorithms** - These are scattered out across .ino files to keep things simple in the main sketch file.  [rainbow.ino](https://github.com/robacarp/bm_lights/blob/master/rainbow.ino), [pink.ino](https://github.com/robacarp/bm_lights/blob/master/pink.ino) and [achromatic.ino](https://github.com/robacarp/bm_lights/blob/master/achromatic.ino) are a few examples.  Thanks to HSB conversion, these algorithms are basically one or two lines.\n  - **Function pointer algorithm switcher** - More or less for my own enjoyment and later reference, I'd never coded with a function pointer in C/C++.  Pundits tell me function pointers are often a bad idea and without pre-setting the pointer in the setup() function, I quickly found out why.  Nevertheless, it was a good exercise and I hope this will provide a reference for myself and whoever else.\n\n\n### As-is Use:\n\nIf you'd like to use this library to control your own series of ShiftBrite lights, feel free.  The configuration variables at the top of [bm_lights.ino](https://github.com/robacarp/bm_lights/blob/master/bm_lights.ino) contain the default pin mappings for the ShiftBrite shield.  If you're using the shield, NUM_LIGHTS is probably the only thing you'll need to configure.\n\nThe algorithm switcher is triggered by an interrupt on pin 3 using the internal pull-up resistor.  Connect a switch between pin 3 and ground to hook into this functionality.  There is some light software debounce, I'd suggest a cap on that circuit if you really want it to be reliable.  YMMV.\n\nThis was verified compiling under Arduino 1.0.1 on 2012-08-20.  If you end up using this code or any parts of it in a project of yours, send me an email description or a picture.  I'd love to hear about it going big places. :-)\n\n\n### License:\n\nCopyright \u0026copy; 2012 Robert Carpenter.\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frobacarp%2Fbm_lights","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frobacarp%2Fbm_lights","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frobacarp%2Fbm_lights/lists"}