Probleme mit Visuino und zusätlichen Codezeilen

Nicht zwangsläufig.

Im einfachsten Fall hilft eine Struktur mit den Farbwerten sowie der Wartezeit und der Angabe, ob ausgegeben werden soll. Dazu dann einen Array anlegen, der die Werte enthält und diesen dann Eintrag für Eintrag mit einer Funktion abarbeiten. Die könnte auch noch den Zufall einstreuen.

Wenn Du es halbwegs schön machst, wird bei der Gelegenheit das delay() gleich noch mit entsorgt - da sind wir wieder beim BlinkWithoutDelay (also nix tun weil die Zeit noch nicht abgelaufen ist oder "was tun" - nämlich die Farbe(n) setzen und ggf. den show() aufrufen).

Sehe ich nicht notwendig; nur verstehen und wissen wo man es zum Kopieren findet wenn man es braucht.
Grüße Uwe

Ich verstehe ja warum man von der delay Funktion weg gehen sollte.
Mir fehlt allerdings anscheinend das Verständnis wo bei mir das Problem herrührt.

Es soll ja nach dem starten die Zeit zwischen dem Einschalten vergehen und die Pixel Frühstens mit dem Einschalten der letzten LED also Pin 8 überhaupt erst Anfangen was zu tun.
Da ja im Loop dann auch kein delay mehr steht sollten der Teil doch auch normal ablaufen, oder?

Ja das glaub ich dir, die sache mit dem Array hab ich auch gelesen, aber verstanden nicht, vom umsetzen ganz zu schweigen xD

Du kochst Spaghetti (ich lebe halt in Italien)
Auf der Packung steht 12 Minuten Kochzeit.
Du wirfst sie ins kochende Wasser.

mit delay() wartest Du bis die 12 Minuten vorbei sind, indem Du auf die Uhr schaust, wie der Zeiger weiterwandert. Du kannst nebenbei keinen Sugo (Soße) machen.

mit millis() kochst Du nebenbei den Sugo und schaust gelegentlich auf die Uhr ob die 12 Minuten vorbei sind. Ein Microcontroller kann einige hunder bis tausendmal pro Sekunde auf die Uhr schauen.

Nach 12 Minuten holst Du die Spaghetti aus dem Wasser usw.

Der Unterschied ist ob Du einen Sugo zu den gekochten Spaghetti hast oder nicht.

Grüße Uwe

1 Like

Ja, wenn Du Deinen Extra-Teil auch ohne delay() umsetzt, bremst Du auch die Loop nicht mehr aus und der Visuino-Code wird wie gewünscht ablaufen.

Edit:

Ist mir heute zu spät für ein Beispiel; vielleicht schaue ich morgen abend mal drauf..

in meinem Sketch die LEDs aufleuchten nur einmal und stören nicht den Loop

Ein kleines Beispiel.
ich will die Pins 3, 4, 6 und 7 als Ausgänge definieren.

byte Ausgange[] = {3,4,5,6};
for (i=0; i<4;i++)
{
pinMode(Ausgang[i], OUTPUT);
}

Alles klar ich denke so grob fang ich an zu verstehen wie das laufen soll....
Fragt sich nur wie man das bzgl. der Farben umsetzt... Müsste ich dann für die jeweiligen Animationsphasen ein entsprechendes Array schreiben?

Wenn ich das Delay heraus nehme, würden ja direkt alle LEDs angehen und Pixel loslaufen, so soll es aber ja nicht ablaufen...

Ich würde ein 2 Dimensionales Array anlegen mit den 3 Grundfarben und die Zeit
Also
int farben[4][] =
{
{1000,0,0,255};
{1000,0,255,0};
{1000,255,0,0}
}
So hast Du zB für je eine Sekunde (1000 Millisekunden) blau, grün und rot.

So hast Du für jeden Schritt i (Variable in welchen Schritt man im Moment befindet) mit
farben[0][i] die Wartezeit für delay() oder besser millis()
farben[1][i] den Farbenwert für rot
farben[2][i] grün
farben[3][i] und blau

Alternativ für bessere Speicherausnutzung, wenn die Wartezeit mehr als 250ms dauern soll und millisekundengenau sein soll:
2 Arrays. Eins vom Typ int für die Wartezeit und ein anderes 2 Dimensionales für die 3 Farbwerte.
auch ein struct könnte funktionieren, das mußt Dir aber jemand anderes erklähren.
Grüße Uwe

Also, ich habe mein eigentliches Problem so ziemlich gelöst, indem ich von delay auf millis gewechselt habe.
Allerdings scheint die Reihenfolge und dauer von den LEDs zu schwanken, außerdem gehen die Pixel direkt beim Einschalten an.
Verstehe das noch nicht so ganz...

Trotzdem würde ich gerne mit der Animation weiter machen :wink:

Aktuellen Sketch gibt es natürlich auch noch

#define VISUINO_ARDUINO_NANO

#include <OpenWire.h>
#include <Mitov.h>
#include <Mitov_NeoPixel.h>
#ifdef __VISUINO_USE_NEO_PIXELS_BUS_LIBRARY__
#include <NeoPixelBrightnessBus.h>  // The 'NeoPixelBus by Makuna' Arduino library https://github.com/Makuna/NeoPixelBus needs to be installed trough the Arduino IDE for this Scetch to compile!
#else // __VISUINO_USE_NEO_PIXELS_BUS_LIBRARY__
#include <Adafruit_NeoPixel.h>  // The 'Adafruit NeoPixel' Arduino library https://github.com/adafruit/Adafruit_NeoPixel needs to be installed trough the Arduino IDE for this Scetch to compile!
#endif // __VISUINO_USE_NEO_PIXELS_BUS_LIBRARY__
#include <Mitov_LedPixels.h>
#ifdef __VISUINO_USE_NEO_PIXELS_BUS_LIBRARY__
#else // __VISUINO_USE_NEO_PIXELS_BUS_LIBRARY__
#endif // __VISUINO_USE_NEO_PIXELS_BUS_LIBRARY__
#include <Mitov_RandomGenerator.h>
#include <Mitov_Color.h>
#include <Mitov_BinaryGenerators.h>
#include <Mitov_BasicGenerator.h>


const unsigned long interval1 = 1500;  
unsigned long previousMillis1 = 0;

int i = 0;

int brightness = 0;

int j = 0;

namespace ComponentVariables
{
class
{
public:
  bool Value1 : 1;
  bool Value2 : 1;
  bool Value3 : 1;
  bool Value4 : 1;
  bool Value5 : 1;
  bool Value6 : 1;
  bool Value7 : 1;
  bool Value8 : 1;

} BitFields;

class Variable1
{
public:
  inline static bool GetValue() { return BitFields.Value1; }
  inline static void SetValue( bool AValue ) { BitFields.Value1 = AValue; }

};

class Variable2
{
public:
  inline static bool GetValue() { return BitFields.Value2; }
  inline static void SetValue( bool AValue ) { BitFields.Value2 = AValue; }

};

class Variable3
{
public:
  inline static bool GetValue() { return BitFields.Value3; }
  inline static void SetValue( bool AValue ) { BitFields.Value3 = AValue; }

};

class Variable4
{
public:
  inline static bool GetValue() { return BitFields.Value4; }
  inline static void SetValue( bool AValue ) { BitFields.Value4 = AValue; }

};

class Variable5
{
public:
  inline static bool GetValue() { return BitFields.Value5; }
  inline static void SetValue( bool AValue ) { BitFields.Value5 = AValue; }

};

class Variable6
{
public:
  inline static bool GetValue() { return BitFields.Value6; }
  inline static void SetValue( bool AValue ) { BitFields.Value6 = AValue; }

};

class Variable7
{
public:
  inline static bool GetValue() { return BitFields.Value7; }
  inline static void SetValue( bool AValue ) { BitFields.Value7 = AValue; }

};

class Variable8
{
public:
  inline static bool GetValue() { return BitFields.Value8; }
  inline static void SetValue( bool AValue ) { BitFields.Value8 = AValue; }

};

} // ComponentVariables

// Arduino Constant Declarations

namespace VisuinoConstants
{
class FloatValue0
{
public:
    inline static constexpr float GetValue() { return 0.100000001490116; }
};

class FloatValue2
{
public:
    inline static constexpr float GetValue() { return 0; }
};

class FloatValue1
{
public:
    inline static constexpr float GetValue() { return 150; }
};

class FloatValue3
{
public:
    inline static constexpr float GetValue() { return 300; }
};

} // VisuinoConstants

// Pin Call Declarations

namespace PinCalls
{
class PinCallerReceive0
{
public:
  void Notify( void *_Data );

};
class PinCallerReceive1
{
public:
  void Notify( void *_Data );

};
class PinCallerReceive2
{
public:
  void Notify( void *_Data );

};
class PinCallerReceive3
{
public:
  void Notify( void *_Data );

};
class PinCallerReceive4
{
public:
  void Notify( void *_Data );

};
class PinCallerReceive5
{
public:
  void Notify( void *_Data );

};
} // PinCalls

// Call Chains

namespace CallChains
{
class PeriodicCall1
{
public:
  inline static constexpr uint32_t Count() { return 0; }
  static void Call();

};
class PeriodicCall2
{
public:
  inline static constexpr uint32_t Count() { return 0; }
  static void Call();

};
} // CallChains

// System Objects Declarations

namespace BoardDeclarations
{
Mitov::TPeriodMicros<3334, ::CallChains::PeriodicCall1> SystemPeriodMicros_3334;
Mitov::TPeriodMicros<1667, ::CallChains::PeriodicCall2> SystemPeriodMicros_1667;
} // BoardDeclarations

// Declarations

namespace Declarations
{
namespace NeoPixel_Declarations
{
#ifdef __VISUINO_USE_NEO_PIXELS_BUS_LIBRARY__
  namespace NeoPixelType
  {
    typedef NeoPixelBrightnessBus<NeoGrbFeature, Neo800KbpsMethod> NeoPixels1;
  }
  NeoPixelType::NeoPixels1 NeoPixels1( 3, 9 );
#else // __VISUINO_USE_NEO_PIXELS_BUS_LIBRARY__
  namespace NeoPixelType
  {
    typedef Adafruit_NeoPixel NeoPixels1;
  }
  NeoPixelType::NeoPixels1 NeoPixels1( 3, 9, NEO_RGB + NEO_KHZ800 );
#endif // __VISUINO_USE_NEO_PIXELS_BUS_LIBRARY__
} // NeoPixel_Declarations
namespace Types
{
typedef Mitov::NeoPixels<
  NeoPixel_Declarations::NeoPixelType::NeoPixels1, // 0_TYPE
  NeoPixel_Declarations::NeoPixels1, // 1_NAME
  Mitov::ConstantPropertyFloat<6, float, ::VisuinoConstants::FloatValue0 >, // Brightness = 0.100000001490116 (Default)
  Mitov::TypedVariable<8, bool, ::ComponentVariables::Variable1 > // FModified
   > NeoPixels1; // TArduinoNeoPixels
} // Types

namespace Instances
{
Types::NeoPixels1 NeoPixels1; // TArduinoNeoPixels
} // Instances

namespace Types
{
typedef Mitov::LedPixelsColorPixelGroup<
  Declarations::Types::NeoPixels1, // 0_TYPE_OWNER
  Declarations::Instances::NeoPixels1, // 1_NAME_OWNER
  3, // 3_COUNT_PIXELS
  0, // 3_START_PIXEL
  Mitov::ConstantProperty<2, bool, true >, // Enabled = True (Default)
  Mitov::TypedVariable<8, bool, ::ComponentVariables::Variable2 >, // FModified
  Mitov::VariablePropertyColor<4, Mitov::TRGBWColor, uint32_t, 0x00000000 >, // InitialColor = 0 (Default)
  Mitov::VariableProperty<7, uint32_t, 0 > // InitialIndex = 0 (Default)
   > TArduinoLedPixelsColorPixelGroup1;
} // Types

namespace Instances
{
Types::TArduinoLedPixelsColorPixelGroup1 TArduinoLedPixelsColorPixelGroup1;
} // Instances

namespace NeoPixel_Declarations
{
#ifdef __VISUINO_USE_NEO_PIXELS_BUS_LIBRARY__
  namespace NeoPixelType
  {
    typedef NeoPixelBrightnessBus<NeoGrbFeature, Neo800KbpsMethod> NeoPixels2;
  }
  NeoPixelType::NeoPixels2 NeoPixels2( 4, 10 );
#else // __VISUINO_USE_NEO_PIXELS_BUS_LIBRARY__
  namespace NeoPixelType
  {
    typedef Adafruit_NeoPixel NeoPixels2;
  }
  NeoPixelType::NeoPixels2 NeoPixels2( 4, 10, NEO_GRB + NEO_KHZ800 );
#endif // __VISUINO_USE_NEO_PIXELS_BUS_LIBRARY__
} // NeoPixel_Declarations
namespace Types
{
typedef Mitov::NeoPixels<
  NeoPixel_Declarations::NeoPixelType::NeoPixels2, // 0_TYPE
  NeoPixel_Declarations::NeoPixels2, // 1_NAME
  Mitov::ConstantPropertyFloat<6, float, ::VisuinoConstants::FloatValue0 >, // Brightness = 0.100000001490116 (Default)
  Mitov::TypedVariable<8, bool, ::ComponentVariables::Variable3 > // FModified
   > NeoPixels2; // TArduinoNeoPixels
} // Types

namespace Instances
{
Types::NeoPixels2 NeoPixels2; // TArduinoNeoPixels
} // Instances

namespace Types
{
typedef Mitov::LedPixelsColorPixelGroup<
  Declarations::Types::NeoPixels2, // 0_TYPE_OWNER
  Declarations::Instances::NeoPixels2, // 1_NAME_OWNER
  4, // 3_COUNT_PIXELS
  0, // 3_START_PIXEL
  Mitov::ConstantProperty<2, bool, true >, // Enabled = True (Default)
  Mitov::TypedVariable<8, bool, ::ComponentVariables::Variable4 >, // FModified
  Mitov::VariablePropertyColor<4, Mitov::TRGBWColor, uint32_t, 0x00000000 >, // InitialColor = 0 (Default)
  Mitov::VariableProperty<7, uint32_t, 0 > // InitialIndex = 0 (Default)
   > TArduinoLedPixelsColorPixelGroup2;
} // Types

namespace Instances
{
Types::TArduinoLedPixelsColorPixelGroup2 TArduinoLedPixelsColorPixelGroup2;
} // Instances

namespace Types
{
typedef Mitov::CommonRandomGenerator<
  float, // 0_TYPE
  Mitov::RandomIntegerGenerator<int32_t>, // 1_BASE
  Mitov::ConstantProperty<5, bool, true >, // Enabled = True (Default)
  Mitov::ConstantProperty<8, int32_t, 3 >, // Value_Max = 3
  Mitov::ConstantProperty<7, int32_t, 0 >, // Value_Min = 0
  Mitov::TypedPin_EmbeddedPinImplementation<3, ::PinCalls::PinCallerReceive0, int32_t >, // OutputPin
  Mitov::ConstantProperty<6, int32_t, 0 > // Seed = 0 (Default)
   > RandomIntegerGenerator1; // TArduinoRandomIntegerGenerator
} // Types

namespace Instances
{
Types::RandomIntegerGenerator1 RandomIntegerGenerator1; // TArduinoRandomIntegerGenerator
} // Instances

namespace Types
{
typedef Mitov::CommonRandomGenerator<
  Mitov::TColor, // 0_TYPE
  Mitov::RandomColorImplementation, // 1_BASE
  Mitov::ConstantProperty<5, bool, true >, // Enabled = True (Default)
  Mitov::ConstantPropertyColor<8, Mitov::TColor, uint32_t, 0x4080FF >, // Value_Max = 4227327
  Mitov::ConstantPropertyColor<7, Mitov::TColor, uint32_t, 0x77ACF4 >, // Value_Min = 7843060
  Mitov::TypedPin_EmbeddedPinImplementation<3, ::PinCalls::PinCallerReceive1, Mitov::TColor >, // OutputPin
  Mitov::ConstantProperty<6, int32_t, 0 > // Seed = 0 (Default)
   > RandomColor1; // TArduinoRandomColor
} // Types

namespace Instances
{
Types::RandomColor1 RandomColor1; // TArduinoRandomColor
} // Instances

namespace Types
{
typedef Mitov::CommonRandomGenerator<
  float, // 0_TYPE
  Mitov::RandomIntegerGenerator<int32_t>, // 1_BASE
  Mitov::ConstantProperty<5, bool, true >, // Enabled = True (Default)
  Mitov::ConstantProperty<8, int32_t, 4 >, // Value_Max = 4
  Mitov::ConstantProperty<7, int32_t, 0 >, // Value_Min = 0
  Mitov::TypedPin_EmbeddedPinImplementation<3, ::PinCalls::PinCallerReceive2, int32_t >, // OutputPin
  Mitov::ConstantProperty<6, int32_t, 0 > // Seed = 0 (Default)
   > RandomIntegerGenerator2; // TArduinoRandomIntegerGenerator
} // Types

namespace Instances
{
Types::RandomIntegerGenerator2 RandomIntegerGenerator2; // TArduinoRandomIntegerGenerator
} // Instances

namespace Types
{
typedef Mitov::CommonRandomGenerator<
  Mitov::TColor, // 0_TYPE
  Mitov::RandomColorImplementation, // 1_BASE
  Mitov::ConstantProperty<5, bool, true >, // Enabled = True (Default)
  Mitov::ConstantPropertyColor<8, Mitov::TColor, uint32_t, 0xC55230 >, // Value_Max = 12931632
  Mitov::ConstantPropertyColor<7, Mitov::TColor, uint32_t, 0xFFD2D2 >, // Value_Min = 16765650
  Mitov::TypedPin_EmbeddedPinImplementation<3, ::PinCalls::PinCallerReceive3, Mitov::TColor >, // OutputPin
  Mitov::ConstantProperty<6, int32_t, 0 > // Seed = 0 (Default)
   > RandomColor2; // TArduinoRandomColor
} // Types

namespace Instances
{
Types::RandomColor2 RandomColor2; // TArduinoRandomColor
} // Instances

namespace Types
{
typedef Mitov::PulseGenerator_Shared<
  Mitov::ConstantPropertyFloat<8, float, ::VisuinoConstants::FloatValue2 >, // Asymmetry = 0 (Default)
  Mitov::ConstantProperty<4, bool, true >, // Enabled = True (Default)
  Mitov::ConstantPropertyFloat<17, float, ::VisuinoConstants::FloatValue2>, // FPhase = 0
  Mitov::TypedVariable<15, bool, ::ComponentVariables::Variable5 >, // FValue
  Mitov::ConstantPropertyFloat<7, float, ::VisuinoConstants::FloatValue1 >, // Frequency = 150
  Mitov::ConstantProperty<5, bool, false >, // InitialValue = False (Default)
  Mitov::DigitalPin_EmbeddedPinImplementation<3, ::PinCalls::PinCallerReceive4 >, // OutputPin
  Mitov::ConstantPropertyFloat<9, float, ::VisuinoConstants::FloatValue2 >, // Phase = 0 (Default)
  Mitov::NestedProperty<14, Mitov::TArduinoGeneratorWhenDisabled<
    Mitov::ConstantProperty<13, bool, false >, // CompleteCycle = False (Default)
    Mitov::ConstantProperty<12, bool, true >, // FCycleCompleted = True
    Mitov::ConstantProperty<11, bool, false > // Reset = False (Default)
     > > // WhenDisabled
   > PulseGenerator1; // TArduinoPulseGenerator
} // Types

namespace Instances
{
Types::PulseGenerator1 PulseGenerator1; // TArduinoPulseGenerator
} // Instances

namespace Types
{
typedef Mitov::PulseGenerator_Shared<
  Mitov::ConstantPropertyFloat<8, float, ::VisuinoConstants::FloatValue2 >, // Asymmetry = 0 (Default)
  Mitov::ConstantProperty<4, bool, true >, // Enabled = True (Default)
  Mitov::ConstantPropertyFloat<17, float, ::VisuinoConstants::FloatValue2>, // FPhase = 0
  Mitov::TypedVariable<15, bool, ::ComponentVariables::Variable6 >, // FValue
  Mitov::ConstantPropertyFloat<7, float, ::VisuinoConstants::FloatValue3 >, // Frequency = 300
  Mitov::ConstantProperty<5, bool, false >, // InitialValue = False (Default)
  Mitov::DigitalPin_EmbeddedPinImplementation<3, ::PinCalls::PinCallerReceive5 >, // OutputPin
  Mitov::ConstantPropertyFloat<9, float, ::VisuinoConstants::FloatValue2 >, // Phase = 0 (Default)
  Mitov::NestedProperty<14, Mitov::TArduinoGeneratorWhenDisabled<
    Mitov::ConstantProperty<13, bool, false >, // CompleteCycle = False (Default)
    Mitov::ConstantProperty<12, bool, true >, // FCycleCompleted = True
    Mitov::ConstantProperty<11, bool, false > // Reset = False (Default)
     > > // WhenDisabled
   > PulseGenerator2; // TArduinoPulseGenerator
} // Types

namespace Instances
{
Types::PulseGenerator2 PulseGenerator2; // TArduinoPulseGenerator
} // Instances

} // Declarations

// Type Converters

namespace TypeConverters
{
Mitov::TypedConvert<Mitov::TColor,Mitov::TRGBWColor> Converter0;
Mitov::TypedConvert<Mitov::TColor,Mitov::TRGBWColor> Converter1;
Mitov::Convert_BinaryToClock<Mitov::TypedVariable<0, bool, ::ComponentVariables::Variable7 > > Converter2;
Mitov::Convert_BinaryToClock<Mitov::TypedVariable<0, bool, ::ComponentVariables::Variable8 > > Converter3;
} // TypeConverters

// Call Chains

namespace CallChains
{
void PeriodicCall1::Call()
{
  Declarations::Instances::PulseGenerator1.PeriodicCall();
}

void PeriodicCall2::Call()
{
  Declarations::Instances::PulseGenerator2.PeriodicCall();
}

} // CallChains

// Pin Call Declarations

namespace PinCalls
{
void PinCallerConverterReceive1( void *_Data );
void PinCallerConverterReceive2( void *_Data );
void PinCallerConverterReceive3( void *_Data );
void PinCallerConverterReceive4( void *_Data );
} // PinCalls

// Pin Call Implementations

namespace PinCalls
{
void PinCallerReceive0::Notify( void *_Data )
{
  Declarations::Instances::TArduinoLedPixelsColorPixelGroup1.IndexInputPin_o_Receive( _Data );
}

void PinCallerReceive1::Notify( void *_Data )
{
  TypeConverters::Converter0.Convert( _Data, PinCallerConverterReceive1 );
}

void PinCallerConverterReceive1( void *_Data )
{
  Declarations::Instances::TArduinoLedPixelsColorPixelGroup1.ColorInputPin_o_Receive( _Data );
}
void PinCallerReceive2::Notify( void *_Data )
{
  Declarations::Instances::TArduinoLedPixelsColorPixelGroup2.IndexInputPin_o_Receive( _Data );
}

void PinCallerReceive3::Notify( void *_Data )
{
  TypeConverters::Converter1.Convert( _Data, PinCallerConverterReceive2 );
}

void PinCallerConverterReceive2( void *_Data )
{
  Declarations::Instances::TArduinoLedPixelsColorPixelGroup2.ColorInputPin_o_Receive( _Data );
}
void PinCallerReceive4::Notify( void *_Data )
{
  TypeConverters::Converter2.Convert( _Data, PinCallerConverterReceive3 );
}

void PinCallerConverterReceive3( void *_Data )
{
  Declarations::Instances::RandomColor1.ClockInputPin_o_Receive( _Data );
  Declarations::Instances::RandomIntegerGenerator1.ClockInputPin_o_Receive( _Data );
}
void PinCallerReceive5::Notify( void *_Data )
{
  TypeConverters::Converter3.Convert( _Data, PinCallerConverterReceive4 );
}

void PinCallerConverterReceive4( void *_Data )
{
  Declarations::Instances::RandomColor2.ClockInputPin_o_Receive( _Data );
  Declarations::Instances::RandomIntegerGenerator2.ClockInputPin_o_Receive( _Data );
}
} // PinCalls

namespace ComponentsHardware
{
void SystemUpdateHardware()
{
}
} // ComponentsHardware

//The setup function is called once at startup of the sketch
void setup()
{

  pinMode(2, OUTPUT);
  pinMode(3, OUTPUT);
  pinMode(4, OUTPUT);
  pinMode(5, OUTPUT);
  pinMode(6, OUTPUT);
  pinMode(7, OUTPUT);
  pinMode(8, OUTPUT);

  BoardDeclarations::SystemPeriodMicros_3334.SystemStarted();
  BoardDeclarations::SystemPeriodMicros_1667.SystemStarted();
  Declarations::Instances::NeoPixels1.SystemInit();
  Declarations::Instances::NeoPixels2.SystemInit();
  Declarations::Instances::TArduinoLedPixelsColorPixelGroup1.SystemStart();
  Declarations::Instances::TArduinoLedPixelsColorPixelGroup2.SystemStart();
  Declarations::Instances::RandomIntegerGenerator1.SystemStartInit();
  Declarations::Instances::RandomColor1.SystemStartInit();
  Declarations::Instances::RandomIntegerGenerator2.SystemStartInit();
  Declarations::Instances::RandomColor2.SystemStartInit();
  Declarations::Instances::PulseGenerator1.SystemStart();
  Declarations::Instances::PulseGenerator2.SystemStart();

}

// The loop function is called in an endless loop
void loop()
{

brightness;

  digitalWrite(2, HIGH);
    
 if (millis() - previousMillis1 > interval1){
    previousMillis1 = millis();   
    digitalWrite(3, HIGH);
}

if (millis() - previousMillis1 > interval1){
    previousMillis1 = millis();   
    digitalWrite(4, HIGH);
}

if (millis() - previousMillis1 > interval1){
    previousMillis1 = millis();   
    digitalWrite(5, HIGH);
  }

if (millis() - previousMillis1 > interval1){
    previousMillis1 = millis();   
    digitalWrite(6, HIGH);
  }

if (millis() - previousMillis1 > interval1){
    previousMillis1 = millis();   
    digitalWrite(7, HIGH);
  }

if (millis() - previousMillis1 > interval1){
    previousMillis1 = millis();   
    digitalWrite(8, HIGH);
 }

  BoardDeclarations::SystemPeriodMicros_3334.SystemLoopBegin();
  BoardDeclarations::SystemPeriodMicros_1667.SystemLoopBegin();
  Declarations::Instances::TArduinoLedPixelsColorPixelGroup1.SystemLoopBegin();
  Declarations::Instances::TArduinoLedPixelsColorPixelGroup2.SystemLoopBegin();
  Declarations::Instances::PulseGenerator1.SystemLoopBegin();
  Declarations::Instances::PulseGenerator2.SystemLoopBegin();
  Declarations::Instances::NeoPixels1.SystemLoopEnd();
  Declarations::Instances::NeoPixels2.SystemLoopEnd();
}

Leider etwas veraltet!

Moderner:

constexpr byte ausgange[]  {3, 4, 5, 6};

void setup()
{
  for ( byte ausgang : ausgange)
  {
    pinMode(ausgang, OUTPUT);
  }
}

void loop()
{
}

Bei Erweiterungen/Kürzungen des Arrays muss keine magische Indexgrenze verschoben werden.

Mantra:
Wo kein Index, da auch kein aus dem Ruder laufen des selben,

bin kein freund von multidimensionalen Arrays für verschiedene sachen. Dafür gäbe es Strukturen

struct Data {
  uint16_t interval;  // wenn zu klein eben uint32_t
  uint8_t r;          // red (ich finde r ist eine zulässige Kürzung für eine Farbe)
  uint8_t g;          // green
  uint8_t b;          // blue
};
Data data[]  {
  {1000, 0, 0, 255},
  {1000, 0, 255, 0},
  {1000, 255, 0, 0},
};

Danke für die Erklährung.
Uwe

Zeigst Du noch bitte wie man die Variablen benutzt.

Grüße Uwe

Strukturname[index].membername

Zb

data[1].r =42

Würde rot überschreiben.

Danke

Soll die sequenz nur einmal ablaufen oder immer wieder? Bei einmal könntest du das ins setup verschieben und dann blockiert es den loop nicht mehr. Ansonsten mit statusabfrage und millis wie schon vorgeschlagen. Dann kann diebSequenz ablaufen während der rest vom loop durchlaufen kann

Sorry, hatte die letzten Tage einiges um die Ohren.

Also was ihr bzgl der Arrays schreibt ist mir tatsächlich völlig zu hoch -_-
Hatte mich mal probiert da einzulesen aber ich fürchte da dies allgemein gehalten ist und sich so gar nicht auf das bezieht was ich damit machen möchte blick ich das nicht.

@Skippolino: Die Sequenz läuft einmal an, sprich die LEDs schalten einmal nacheinander an und bleiben an, während die Pixel eine "Zündsequenz" haben und in eine "Betriebssequenz" übergehen und diese dann quasi unendlich weiter ausführen.

Also ich als totaler Laie würde das vom Ablauf so machen:


void setup()
{
  startStatus = 0;
  zuendStatus = 0;
}
void loop()
{
  //Startsequenz
  if (startStatus == 0)
  {
    //führe hier die Startsequenz aus
    startStatus = 1; //somit ist gestartet und wird nicht mehr durchlaufen, bis dies zurückgesetzt wird
  }
  //Zündsequenz ausführen
  if (zeundStatus == 0)
  {
    //führe hier die Zuendsequenz aus
    zuendStatus = 1; //somit ist gestartet und wird nicht mehr durchlaufen, bis dies zurückgesetzt wird
  }
  //mach was immer du willst
}

Die einzelnen Sequenzen weisst Du ja jetzt wie mit millis, arrays etc. Wenn du eine Sequenz wiederholen wilst, z.B. wenn das cockpit ausfällt, kannst du diesen Status irgendwo auf 0 setzen, und dann rennt das nochmals durch....soweit die theorie...getestet habe ich das nicht.