From e842d97a1b3970d47a9ac4cd2ba02a5cdb5cea6d Mon Sep 17 00:00:00 2001 From: Alexander Popov Date: Tue, 13 May 2025 04:45:45 +0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=98=B5=E2=80=8D=F0=9F=92=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .editorconfig | 20 ++++++++++++++++++++ .gitignore | 1 + LICENSE | 24 ++++++++++++++++++++++++ README.md | 13 +++++++++++++ compile.sh | 7 +++++++ src/LED_Panel/.clang-format | 8 ++++++++ src/LED_Panel/LED_Panel.ino | 25 +++++++++++++++++++++++++ src/LED_Panel/config.hpp | 4 ++++ upload.sh | 7 +++++++ 9 files changed, 109 insertions(+) create mode 100644 .editorconfig create mode 100644 .gitignore create mode 100644 LICENSE create mode 100644 README.md create mode 100755 compile.sh create mode 100644 src/LED_Panel/.clang-format create mode 100644 src/LED_Panel/LED_Panel.ino create mode 100644 src/LED_Panel/config.hpp create mode 100755 upload.sh diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..5d6fbbb --- /dev/null +++ b/.editorconfig @@ -0,0 +1,20 @@ +# EditorConfig is awesome: https://EditorConfig.org +root = true + +# for all projects +[*] +indent_style = space +indent_size = 4 +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true + +# C++ +[{*.cpp,*.ino,*.hpp}] +indent_style = space +indent_size = 2 + +# Markdown +[*.md] +trim_trailing_whitespace = false diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..567609b --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +build/ diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..cf1ab25 --- /dev/null +++ b/LICENSE @@ -0,0 +1,24 @@ +This is free and unencumbered software released into the public domain. + +Anyone is free to copy, modify, publish, use, compile, sell, or +distribute this software, either in source code form or as a compiled +binary, for any purpose, commercial or non-commercial, and by any +means. + +In jurisdictions that recognize copyright laws, the author or authors +of this software dedicate any and all copyright interest in the +software to the public domain. We make this dedication for the benefit +of the public at large and to the detriment of our heirs and +successors. We intend this dedication to be an overt act of +relinquishment in perpetuity of all present and future rights to this +software under copyright law. + +THE 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 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. + +For more information, please refer to diff --git a/README.md b/README.md new file mode 100644 index 0000000..a59ea62 --- /dev/null +++ b/README.md @@ -0,0 +1,13 @@ +--- +gitea: none +include_toc: true +--- + +# 💡 LED Panel + +... + + +## ✨ Requirements + +* 🟡 `Adafruit_NeoPixel` [1.13.0](https://github.com/adafruit/Adafruit_NeoPixel/releases/tag/1.13.0) diff --git a/compile.sh b/compile.sh new file mode 100755 index 0000000..5f12006 --- /dev/null +++ b/compile.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +BUILD_DIR="./build" +BOARD="arduino:avr:uno" +PROJECT_PATH="./src/LED_Panel" + +arduino-cli compile --output-dir $BUILD_DIR -b $BOARD $PROJECT_PATH diff --git a/src/LED_Panel/.clang-format b/src/LED_Panel/.clang-format new file mode 100644 index 0000000..6709ba0 --- /dev/null +++ b/src/LED_Panel/.clang-format @@ -0,0 +1,8 @@ +Language: Cpp +BasedOnStyle: LLVM +IndentWidth: 2 +ColumnLimit: 132 +SortIncludes: true +AlignAfterOpenBracket: DontAlign +AllowShortIfStatementsOnASingleLine: AllIfsAndElse +AllowShortLoopsOnASingleLine: true diff --git a/src/LED_Panel/LED_Panel.ino b/src/LED_Panel/LED_Panel.ino new file mode 100644 index 0000000..f283c5d --- /dev/null +++ b/src/LED_Panel/LED_Panel.ino @@ -0,0 +1,25 @@ +/* + Author: Alexander Popov aka iiiypuk aka i3k + Repo: https://git.a2s.su/Pix-Backpack/LED-Panel + License: Public Domain +*/ + +#include + +#include "config.hpp" + +Adafruit_NeoPixel pixels = Adafruit_NeoPixel(LED_COUNT, PIN, NEO_GRB + NEO_KHZ800); + +void setup() { + pixels.begin(); + pixels.show(); // disable all LED +} + +void loop() { + for (int i = 0; i < LED_COUNT - 1; i++) { + pixels.setPixelColor(i - 1, pixels.Color(0, 0, 0)); + pixels.setPixelColor(i, pixels.Color(255, 0, 0)); + pixels.show(); + delay(100); + } +} diff --git a/src/LED_Panel/config.hpp b/src/LED_Panel/config.hpp new file mode 100644 index 0000000..2066f96 --- /dev/null +++ b/src/LED_Panel/config.hpp @@ -0,0 +1,4 @@ +const uint8_t PIN = 6; // DIN PIN +const uint8_t WIDTH = 16; // LED matrix width +const uint8_t HEIGHT = 20; // LED matrix height +const uint16_t LED_COUNT = WIDTH * HEIGHT; // LED count diff --git a/upload.sh b/upload.sh new file mode 100755 index 0000000..4f5f6e5 --- /dev/null +++ b/upload.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +BUILD_DIR="./build" +BOARD="arduino:avr:uno" +PORT="/dev/ttyACM0" + +arduino-cli upload -b $BOARD -p $PORT --input-dir $BUILD_DIR