-
-
Notifications
You must be signed in to change notification settings - Fork 246
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11 from IncursioHack/main
Cardputer LED control (StampS3).
- Loading branch information
Showing
5 changed files
with
155 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
#ifdef CARDPUTER | ||
// By @IncursioHack - github.com/IncursioHack | ||
#include "display.h" | ||
#include "globals.h" | ||
#include "led_control.h" | ||
#include <LiteLED.h> | ||
|
||
// Escolha o tipo de LED na lista abaixo. | ||
// Comente todos menos um LED_TYPE. | ||
// #define LED_TYPE LED_STRIP_WS2812 | ||
#define LED_TYPE LED_STRIP_SK6812 | ||
// #define LED_STRIP_APA106 | ||
// #define LED_STRIP_SM16703 | ||
|
||
#define LED_TYPE_IS_RGBW 1 // Se o LED for do tipo RGBW, altere o 0 para 1 | ||
#define LED_BRIGHT 245 // Define o brilho do LED. "0" está desligado; 255 pode queimar seus olhos (não recomendado) | ||
|
||
LiteLED myLED( LED_TYPE, LED_TYPE_IS_RGBW ); // Cria o objeto LiteLED com o nome "myLED" | ||
|
||
void ledrgb_setup() { | ||
myLED.begin( RGB_LED, 1 ); // Inicialize o objeto myLED. Aqui temos 1 LED conectado ao pino RGB_LED | ||
myLED.brightness( LED_BRIGHT, 1 ); // Ligue o LED | ||
|
||
options = { | ||
{"OFF", [=]() { myLED.brightness( 0, 1 ); }}, | ||
{"PURPLE", [=]() { myLED.setPixel( 0, L_PURPLE, 1 ); }}, | ||
{"WHITE", [=]() { myLED.setPixel( 0, L_WHITE, 1 ); }}, | ||
{"RED", [=]() { myLED.setPixel( 0, L_RED, 1 ); }}, | ||
{"GREEN", [=]() { myLED.setPixel( 0, L_GREEN, 1 ); }}, | ||
{"BLUE", [=]() { myLED.setPixel( 0, L_BLUE, 1 ); }}, | ||
}; | ||
delay(200); | ||
loopOptions(options); | ||
delay(200); | ||
} | ||
|
||
void ledrgb_flash() { | ||
myLED.begin( RGB_LED, 1 ); // Inicialize o objeto myLED. Aqui temos 1 LED conectado ao pino RGB_LED | ||
myLED.brightness( LED_BRIGHT_DEFAULT, 1 ); // Ligue o LED | ||
myLED.setPixel( 0, L_PURPLE, 1 ); | ||
delay(1000); | ||
myLED.brightness( 0, 1 ); | ||
delay(1000); | ||
myLED.brightness( LED_BRIGHT_DEFAULT, 1 ); | ||
delay(1000); | ||
myLED.brightness( 0, 1 ); | ||
delay(1000); | ||
myLED.brightness( LED_BRIGHT_DEFAULT, 1 ); | ||
delay(1000); | ||
myLED.brightness( 0, 1 ); | ||
delay(1000); | ||
myLED.brightness( LED_BRIGHT_DEFAULT, 1 ); | ||
delay(1000); | ||
myLED.brightness( 0, 1 ); | ||
} | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#ifdef CARDPUTER | ||
// By IncursioHack @github.com/IncursioHack | ||
#include <Arduino.h> | ||
#include <LiteLED.h> | ||
|
||
// Escolha o tipo de LED na lista abaixo. Comente todos, exceto o que você está usando. | ||
#define LED_TYPE LED_STRIP_SK6812 | ||
// #define LED_STRIP_WS2812 | ||
// #define LED_STRIP_APA106 | ||
// #define LED_STRIP_SM16703 | ||
|
||
#define LED_TYPE_IS_RGBW 1 // Se o LED for do tipo RGBW, altere o 0 para 1 | ||
|
||
// Definição de intensidade de brilho | ||
#define LED_BRIGHT_DEFAULT 245 // Define o brilho padrão do LED. "0" é desligado; 255 pode ser muito brilhante. | ||
|
||
// Cores predefinidas para o LED | ||
static const crgb_t L_RED = 0xff0000; | ||
static const crgb_t L_GREEN = 0x00ff00; | ||
static const crgb_t L_BLUE = 0x0000ff; | ||
static const crgb_t L_WHITE = 0xe0e0e0; | ||
static const crgb_t L_PURPLE = 0xff00ff; | ||
|
||
// Declaração do objeto LiteLED | ||
extern LiteLED myLED; | ||
|
||
// Declarações de funções para controle do LED RGB | ||
void ledrgb_setup(); | ||
void ledrgb_flash(); | ||
|
||
#endif |
Oops, something went wrong.