kk logo

heisser draht neo pixel anzeige 12 fehler anzeige bauen

 

 

#include <Adafruit_NeoPixel.h>

Adafruit_NeoPixel strip_pin6 = Adafruit_NeoPixel(12,6, NEO_RGB + NEO_KHZ800);
int zaeler = 0 ;
int pixel = 0 ;
int fehler = 0 ;
int farbe = 0 ;
bool entprellen= false ;
int entprellenstopp = 0 ;
int summerstopp = 0 ;
int rot = 0 ;
int greun = 0 ;
int blau = 0 ;
int rot1 = 0 ;
int greun1 = 0 ;
int blau1 = 0 ;
int farben = 0 ;

void Unterprogramm1();
void Unterprogramm2();
void Unterprogramm3();
void Unterprogramm4();

void setup()
{
pinMode( 2 , INPUT);
pinMode( 4 , INPUT);
strip_pin6.begin();
strip_pin6.show();
pinMode( 4 , OUTPUT);
Serial.begin(9600);
randomSeed(analogRead(A0) + analogRead(A1) + analogRead(A2));

strip_pin6.setBrightness(200);

zaeler = -1 ;

pixel = -1 ;

fehler = 0 ;

farbe = 0 ;

entprellen = LOW ;

entprellenstopp = 0 ;

summerstopp = 0 ;

rot = 0 ;

greun = 0 ;

blau = 0 ;

rot1 = 0 ;

greun1 = 0 ;

blau1 = 0 ;

farben = 0 ;

}

void loop()
{
long current=millis();
while(current+100>=millis())
{
if (( digitalRead(2) && !( entprellen ) ))
{
fehler = ( fehler + 1 ) ;
entprellen = HIGH ;
digitalWrite( 4 , HIGH );
}
}
zaeler = ( zaeler + 1 ) ;
farben = ( farben + 1 ) ;
Serial.print(farben);
Serial.println();
Unterprogramm2();
Unterprogramm3();
Unterprogramm4();
}

void Unterprogramm3()
{
if (( ( zaeler ) <= ( 12 ) ))
{
pixel = ( pixel + 1 ) ;
strip_pin6.setPixelColor(pixel,rot ,greun ,blau );
Unterprogramm1();
strip_pin6.show();
}
if (( ( zaeler ) == ( 13 ) ))
{
pixel = -1 ;
zaeler = 14 ;
}
if (( ( zaeler ) >= ( 14 ) ))
{
pixel = ( pixel + 1 ) ;
strip_pin6.setPixelColor(pixel,rot1 ,greun1 ,blau1 );
Unterprogramm1();
strip_pin6.show();
}
if (( ( zaeler ) == ( 25 ) ))
{
zaeler = 0 ;
pixel = -1 ;
}
}

void Unterprogramm2()
{
if (entprellen)
{
entprellenstopp = ( entprellenstopp + 1 ) ;
}
if (digitalRead(4))
{
summerstopp = ( summerstopp + 1 ) ;
}
if (( ( entprellenstopp ) == ( 10 ) ))
{
entprellen = LOW ;
entprellenstopp = 0 ;
}
if (( ( summerstopp ) == ( 30 ) ))
{
summerstopp = 0 ;
digitalWrite( 4 , LOW );
}
}

void Unterprogramm4()
{
if (( ( farben ) == ( 1 ) ))
{
rot1 = random( 50 ) ;
greun1 = random( 50 ) ;
blau1 = random( 50 ) ;
}
if (( ( farben ) == ( 24 ) ))
{
rot = random( 50 ) ;
greun = random( 50 ) ;
blau = random( 50 ) ;
farben = 0 ;
}
}

void Unterprogramm1()
{
if (( ( 1 ) <= ( fehler ) ))
{
strip_pin6.setPixelColor(0,2 ,255 ,2 );
strip_pin6.show();
}
if (( ( 2 ) <= ( fehler ) ))
{
strip_pin6.setPixelColor(1,2 ,255 ,2 );
strip_pin6.show();
}
if (( ( 3 ) <= ( fehler ) ))
{
strip_pin6.setPixelColor(2,2 ,255 ,2 );
strip_pin6.show();
}
if (( ( 4 ) <= ( fehler ) ))
{
strip_pin6.setPixelColor(3,2 ,255 ,2 );
strip_pin6.show();
}
if (( ( 5 ) <= ( fehler ) ))
{
strip_pin6.setPixelColor(4,2 ,255 ,2 );
strip_pin6.show();
}
if (( ( 6 ) <= ( fehler ) ))
{
strip_pin6.setPixelColor(5,2 ,255 ,2 );
strip_pin6.show();
}
if (( ( 7 ) <= ( fehler ) ))
{
strip_pin6.setPixelColor(6,2 ,255 ,2 );
strip_pin6.show();
}
if (( ( 8 ) <= ( fehler ) ))
{
strip_pin6.setPixelColor(7,2 ,255 ,2 );
strip_pin6.show();
}
if (( ( 9 ) <= ( fehler ) ))
{
strip_pin6.setPixelColor(8,2 ,255 ,2 );
strip_pin6.show();
}
if (( ( 10 ) <= ( fehler ) ))
{
strip_pin6.setPixelColor(9,2 ,255 ,2 );
strip_pin6.show();
}
if (( ( 11 ) <= ( fehler ) ))
{
strip_pin6.setPixelColor(10,2 ,255 ,2 );
strip_pin6.show();
}
if (( ( 12 ) <= ( fehler ) ))
{
strip_pin6.setPixelColor(11,2 ,255 ,2 );
strip_pin6.show();
}
}

goodness

And all my life You have been faithful
And all my life You have been so, so good
With every breath that I am able
Oh, I will sing of the goodness of God

Ronnie

schwäbischer tüftler und bastler, kraftsportler, 41 Jahre, 1 Frau, 5 Kinder und 1003 Ideen. 

ronnie berzins at mee

Wir nutzen Cookies auf unserer Website. Einige von ihnen sind essenziell für den Betrieb der Seite, während andere uns helfen, diese Website und die Nutzererfahrung zu verbessern (Tracking Cookies). Sie können selbst entscheiden, ob Sie die Cookies zulassen möchten. Bitte beachten Sie, dass bei einer Ablehnung womöglich nicht mehr alle Funktionalitäten der Seite zur Verfügung stehen.