#define FASTLED_INTERNAL // Disable version number message in FastLED library (looks like an error)
#include "FastLED.h" // The FastLED library must be installed in addition if you got the error message "..fatal error: FastLED.h: No such file or directory"
// Arduino IDE: Sketch / Include library / Manage libraries Deutsche IDE: Sketch / Bibliothek einbinden / Bibliothek verwalten
// Type "FastLED" in the "Filter your search..." field "FastLED" in das "Grenzen Sie ihre Suche ein" Feld eingeben
// Select the entry and click "Install" Gefundenen Eintrag auswaehlen und "Install" anklicken
#include "MobaLedLib.h" // Use the Moba Led Library
#define NUM_LEDS 32 // Number of LEDs with some spare channels (Maximal 256 RGB LEDs could be used)
#define LED_DO_PIN 6 // Pin D6 is connected to the LED stripe
#define SWITCH0_PIN 7 // Pin D7 is connected to switch 0
#define SWITCH1_PIN 8 // Pin D8 is connected to switch 1
#define SWITCH2_PIN 9 // Pin D9 is connected to switch 2
#define Schornsteinfeger_StCh(LED,StCh,InNr,Time) PatternT1(LED,StCh+128,InNr,1,10,200,0,PM_SEQUENZ_NO_RESTART,Time,85,5)
//*******************************************************************
// *** Configuration array which defines the behavior of the LEDs ***
MobaLedLib_Configuration()
{// LED: LED number in the stripe
// |
Schornsteinfeger_StCh(1, 0, 0, 1 sek)
Schornsteinfeger_StCh(1, 1, 1, 4 sek)
Schornsteinfeger_StCh(1, 2, 2, 2 sek)
//Const( 1,C_ALL,1,0, 25)
//Const( 2,C_ALL,2,0, 25)
//RGB_Heartbeat(NUM_LEDS-1) // Use the last LED in the stripe as heartbeat
//RGB_Heartbeat(0) // The first LED is also flashing
EndCfg // End of the configuration
};
//*******************************************************************
CRGB leds[NUM_LEDS]; // Define the array of leds
MobaLedLib_Create(leds); // Define the MobaLedLib instance
LED_Heartbeat_C LED_Heartbeat(LED_BUILTIN); // Use the build in LED as heartbeat
//----------
void setup(){
//----------
// This function is called once to initialize the program
//
FastLED.addLeds<NEOPIXEL, LED_DO_PIN>(leds, NUM_LEDS); // Initialize the FastLED library
pinMode(SWITCH0_PIN, INPUT_PULLUP); // Activate an internal pullup resistor for the input pins
pinMode(SWITCH1_PIN, INPUT_PULLUP);
pinMode(SWITCH2_PIN, INPUT_PULLUP);
}
//---------
void loop(){
//---------
// This function contains the main loop which is executed continuously
//
MobaLedLib.Set_Input(0, !digitalRead(SWITCH0_PIN));
MobaLedLib.Set_Input(1, !digitalRead(SWITCH1_PIN));
MobaLedLib.Set_Input(2, !digitalRead(SWITCH2_PIN));
MobaLedLib.Update(); // Update the LEDs in the configuration
FastLED.show(); // Show the LEDs (send the leds[] array to the LED stripe)
LED_Heartbeat.Update(); // Update the heartbeat LED. This must be called periodically in the loop() function.
}