Hallo zusammen,
ich habe über Visuino einen Code für meine Neopixel ertsellt. Dieser läuft auch wie er soll.
Da ich aber noch zusätzlich vorher noch ein paar LEDs verzögert einschalten möchte habe ich den entsprechenden Code noch addiert.
Allerdings habe ich jetzt das Problem das die Neopixel jetzt nur noch in Zeitlupe das tun was sie tun sollen.
Sobald ich die Zeilen die am Anfang des Loops stehen wieder entferne, laufen die Pixel wieder wie geplant...
Hat jemand eine Idee wo das Problem liegen könnte?
LG Holger
//----------------------------------------------
//
// Sketch Generated by Visuino
// www.visuino.com
// Version 8.0.0.125
//
//------------------ Source --------------------
//
// WIP1.visuino
//
//----------------------------------------------
#define __V_REFF_ 5.0f
#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>
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 FloatValue3
{
public:
inline static constexpr float GetValue() { return 300; }
};
class FloatValue1
{
public:
inline static constexpr float GetValue() { return 200; }
};
} // 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<2500, ::CallChains::PeriodicCall1> SystemPeriodMicros_2500;
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_GRB + 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, 0xFF0000 >, // Value_Max = 16711680
Mitov::ConstantPropertyColor<7, Mitov::TColor, uint32_t, 0xFF9191 >, // Value_Min = 16748945
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 = 200
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_2500.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);
delay(2000); // Wait for 500 millisecond(s)
digitalWrite(3, HIGH);
delay(2000); // Wait for 500 millisecond(s)
digitalWrite(4, HIGH);
delay(2000); // Wait for 500 millisecond(s)
digitalWrite(5, HIGH);
delay(2000); // Wait for 500 millisecond(s)
digitalWrite(6, HIGH);
delay(2000); // Wait for 500 millisecond(s)
digitalWrite(7, HIGH);
delay(2000); // Wait for 500 millisecond(s)
digitalWrite(8, HIGH);
BoardDeclarations::SystemPeriodMicros_2500.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();
}