heisser Draht spiel mit 8x8 LED Matrix Arduino Code

 

 

8x8 led matrix heissen draht bauen zahlen

 

Code


#include <Sprite.h>
#include <Matrix.h>

int fehler = 0 ;
int zeit ;

Matrix mesLeds121110 = Matrix(12,11,10,1);
int X[] = {
0,7,6,5,4,3,2,1};
int Y[] = {
7,6,5,4,3,2,1,0};

void Unterprogramm0();

void setup()
{
pinMode( 7 , INPUT);
pinMode( 5 , OUTPUT);
mesLeds121110.clear();
mesLeds121110.setBrightness(15);
fehler = 0 ;
delay(5);

{
for (zeit; zeit<= ( 5 ); ++zeit )
{
mesLeds121110.write(X[0],Y[1],HIGH);
mesLeds121110.write(X[1],Y[1],HIGH);
mesLeds121110.write(X[2],Y[1],HIGH);
mesLeds121110.write(X[3],Y[1],HIGH);
mesLeds121110.write(X[4],Y[1],HIGH);
mesLeds121110.write(X[5],Y[1],HIGH);
mesLeds121110.write(X[6],Y[1],HIGH);
mesLeds121110.write(X[7],Y[1],HIGH);

mesLeds121110.write(X[0],Y[2],HIGH);
mesLeds121110.write(X[1],Y[2],HIGH);
mesLeds121110.write(X[2],Y[2],HIGH);
mesLeds121110.write(X[3],Y[2],HIGH);
mesLeds121110.write(X[4],Y[2],HIGH);
mesLeds121110.write(X[5],Y[2],HIGH);
mesLeds121110.write(X[6],Y[2],HIGH);
mesLeds121110.write(X[7],Y[2],HIGH);

mesLeds121110.write(X[0],Y[5],HIGH);
mesLeds121110.write(X[1],Y[5],HIGH);
mesLeds121110.write(X[2],Y[5],HIGH);
mesLeds121110.write(X[3],Y[5],HIGH);
mesLeds121110.write(X[4],Y[5],HIGH);
mesLeds121110.write(X[5],Y[5],HIGH);
mesLeds121110.write(X[6],Y[5],HIGH);
mesLeds121110.write(X[7],Y[5],HIGH);

mesLeds121110.write(X[0],Y[6],HIGH);
mesLeds121110.write(X[1],Y[6],HIGH);
mesLeds121110.write(X[2],Y[6],HIGH);
mesLeds121110.write(X[3],Y[6],HIGH);
mesLeds121110.write(X[4],Y[6],HIGH);
mesLeds121110.write(X[5],Y[6],HIGH);
mesLeds121110.write(X[6],Y[6],HIGH);
mesLeds121110.write(X[7],Y[6],HIGH);

mesLeds121110.write(X[7],Y[3],HIGH);
mesLeds121110.write(X[7],Y[4],HIGH);
mesLeds121110.write(X[6],Y[3],HIGH);
mesLeds121110.write(X[6],Y[4],HIGH);

mesLeds121110.write(X[0],Y[3],HIGH);
mesLeds121110.write(X[0],Y[4],HIGH);
mesLeds121110.write(X[1],Y[3],HIGH);
mesLeds121110.write(X[1],Y[4],HIGH);

delay(300);

mesLeds121110.write(X[0],Y[1],LOW);
mesLeds121110.write(X[1],Y[1],LOW);
mesLeds121110.write(X[2],Y[1],LOW);
mesLeds121110.write(X[3],Y[1],LOW);
mesLeds121110.write(X[4],Y[1],LOW);
mesLeds121110.write(X[5],Y[1],LOW);
mesLeds121110.write(X[6],Y[1],LOW);
mesLeds121110.write(X[7],Y[1],LOW);

mesLeds121110.write(X[0],Y[2],LOW);
mesLeds121110.write(X[1],Y[2],LOW);
mesLeds121110.write(X[2],Y[2],LOW);
mesLeds121110.write(X[3],Y[2],LOW);
mesLeds121110.write(X[4],Y[2],LOW);
mesLeds121110.write(X[5],Y[2],LOW);
mesLeds121110.write(X[6],Y[2],LOW);
mesLeds121110.write(X[7],Y[2],LOW);

mesLeds121110.write(X[0],Y[5],LOW);
mesLeds121110.write(X[1],Y[5],LOW);
mesLeds121110.write(X[2],Y[5],LOW);
mesLeds121110.write(X[3],Y[5],LOW);
mesLeds121110.write(X[4],Y[5],LOW);
mesLeds121110.write(X[5],Y[5],LOW);
mesLeds121110.write(X[6],Y[5],LOW);
mesLeds121110.write(X[7],Y[5],LOW);

mesLeds121110.write(X[0],Y[6],LOW);
mesLeds121110.write(X[1],Y[6],LOW);
mesLeds121110.write(X[2],Y[6],LOW);
mesLeds121110.write(X[3],Y[6],LOW);
mesLeds121110.write(X[4],Y[6],LOW);
mesLeds121110.write(X[5],Y[6],LOW);
mesLeds121110.write(X[6],Y[6],LOW);
mesLeds121110.write(X[7],Y[6],LOW);

mesLeds121110.write(X[7],Y[3],LOW);
mesLeds121110.write(X[7],Y[4],LOW);
mesLeds121110.write(X[6],Y[3],LOW);
mesLeds121110.write(X[6],Y[4],LOW);

mesLeds121110.write(X[0],Y[3],LOW);
mesLeds121110.write(X[0],Y[4],LOW);
mesLeds121110.write(X[1],Y[3],LOW);
mesLeds121110.write(X[1],Y[4],LOW);

delay (300);

}

mesLeds121110.write(X[0],Y[1],HIGH);
mesLeds121110.write(X[1],Y[1],HIGH);
mesLeds121110.write(X[2],Y[1],HIGH);
mesLeds121110.write(X[3],Y[1],HIGH);
mesLeds121110.write(X[4],Y[1],HIGH);
mesLeds121110.write(X[5],Y[1],HIGH);
mesLeds121110.write(X[6],Y[1],HIGH);
mesLeds121110.write(X[7],Y[1],HIGH);

mesLeds121110.write(X[0],Y[2],HIGH);
mesLeds121110.write(X[1],Y[2],HIGH);
mesLeds121110.write(X[2],Y[2],HIGH);
mesLeds121110.write(X[3],Y[2],HIGH);
mesLeds121110.write(X[4],Y[2],HIGH);
mesLeds121110.write(X[5],Y[2],HIGH);
mesLeds121110.write(X[6],Y[2],HIGH);
mesLeds121110.write(X[7],Y[2],HIGH);

mesLeds121110.write(X[0],Y[5],HIGH);
mesLeds121110.write(X[1],Y[5],HIGH);
mesLeds121110.write(X[2],Y[5],HIGH);
mesLeds121110.write(X[3],Y[5],HIGH);
mesLeds121110.write(X[4],Y[5],HIGH);
mesLeds121110.write(X[5],Y[5],HIGH);
mesLeds121110.write(X[6],Y[5],HIGH);
mesLeds121110.write(X[7],Y[5],HIGH);

mesLeds121110.write(X[0],Y[6],HIGH);
mesLeds121110.write(X[1],Y[6],HIGH);
mesLeds121110.write(X[2],Y[6],HIGH);
mesLeds121110.write(X[3],Y[6],HIGH);
mesLeds121110.write(X[4],Y[6],HIGH);
mesLeds121110.write(X[5],Y[6],HIGH);
mesLeds121110.write(X[6],Y[6],HIGH);
mesLeds121110.write(X[7],Y[6],HIGH);

mesLeds121110.write(X[7],Y[3],HIGH);
mesLeds121110.write(X[7],Y[4],HIGH);
mesLeds121110.write(X[6],Y[3],HIGH);
mesLeds121110.write(X[6],Y[4],HIGH);

mesLeds121110.write(X[0],Y[3],HIGH);
mesLeds121110.write(X[0],Y[4],HIGH);
mesLeds121110.write(X[1],Y[3],HIGH);
mesLeds121110.write(X[1],Y[4],HIGH);

}

}

void loop()
{
if (digitalRead(7))
{
fehler = ( fehler + 1 ) ;
digitalWrite( 5 , HIGH );
delay( 200 );
Unterprogramm0();
delay( 50 );

if (( ( fehler ) == ( 1 ) ))
{

mesLeds121110.write(X[0],Y[4],HIGH);
mesLeds121110.write(X[1],Y[4],HIGH);
mesLeds121110.write(X[2],Y[4],HIGH);
mesLeds121110.write(X[3],Y[4],HIGH);
mesLeds121110.write(X[4],Y[4],HIGH);
mesLeds121110.write(X[5],Y[4],HIGH);
mesLeds121110.write(X[6],Y[4],HIGH);
mesLeds121110.write(X[7],Y[4],HIGH);

mesLeds121110.write(X[0],Y[5],HIGH);
mesLeds121110.write(X[1],Y[5],HIGH);
mesLeds121110.write(X[2],Y[5],HIGH);
mesLeds121110.write(X[3],Y[5],HIGH);
mesLeds121110.write(X[4],Y[5],HIGH);
mesLeds121110.write(X[5],Y[5],HIGH);
mesLeds121110.write(X[6],Y[5],HIGH);
mesLeds121110.write(X[7],Y[5],HIGH);

mesLeds121110.write(X[6],Y[3],HIGH);
mesLeds121110.write(X[5],Y[2],HIGH);
mesLeds121110.write(X[4],Y[1],HIGH);

mesLeds121110.write(X[5],Y[3],HIGH);
mesLeds121110.write(X[4],Y[2],HIGH);
mesLeds121110.write(X[3],Y[1],HIGH);

delay( 600 );
digitalWrite( 5 , LOW );

}

if (( ( fehler ) == ( 2 ) ))
{

mesLeds121110.write(X[7],Y[1],HIGH);
mesLeds121110.write(X[7],Y[2],HIGH);
mesLeds121110.write(X[7],Y[3],HIGH);
mesLeds121110.write(X[7],Y[4],HIGH);
mesLeds121110.write(X[7],Y[5],HIGH);
mesLeds121110.write(X[7],Y[6],HIGH);

mesLeds121110.write(X[6],Y[1],HIGH);
mesLeds121110.write(X[6],Y[2],HIGH);
mesLeds121110.write(X[6],Y[3],HIGH);
mesLeds121110.write(X[6],Y[4],HIGH);
mesLeds121110.write(X[6],Y[5],HIGH);
mesLeds121110.write(X[6],Y[6],HIGH);

mesLeds121110.write(X[4],Y[1],HIGH);
mesLeds121110.write(X[4],Y[2],HIGH);
mesLeds121110.write(X[4],Y[3],HIGH);
mesLeds121110.write(X[4],Y[4],HIGH);
mesLeds121110.write(X[4],Y[5],HIGH);
mesLeds121110.write(X[4],Y[6],HIGH);

mesLeds121110.write(X[3],Y[1],HIGH);
mesLeds121110.write(X[3],Y[2],HIGH);
mesLeds121110.write(X[3],Y[3],HIGH);
mesLeds121110.write(X[3],Y[4],HIGH);
mesLeds121110.write(X[3],Y[5],HIGH);
mesLeds121110.write(X[3],Y[6],HIGH);

mesLeds121110.write(X[1],Y[1],HIGH);
mesLeds121110.write(X[1],Y[2],HIGH);
mesLeds121110.write(X[1],Y[3],HIGH);
mesLeds121110.write(X[1],Y[4],HIGH);
mesLeds121110.write(X[1],Y[5],HIGH);
mesLeds121110.write(X[1],Y[6],HIGH);

mesLeds121110.write(X[0],Y[1],HIGH);
mesLeds121110.write(X[0],Y[2],HIGH);
mesLeds121110.write(X[0],Y[3],HIGH);
mesLeds121110.write(X[0],Y[4],HIGH);
mesLeds121110.write(X[0],Y[5],HIGH);
mesLeds121110.write(X[0],Y[6],HIGH);

mesLeds121110.write(X[2],Y[1],HIGH);
mesLeds121110.write(X[2],Y[2],HIGH);

mesLeds121110.write(X[5],Y[5],HIGH);
mesLeds121110.write(X[5],Y[6],HIGH);

delay( 600 );
digitalWrite( 5 , LOW );

}

if (( ( fehler ) == ( 3 ) ))
{

mesLeds121110.write(X[7],Y[1],HIGH);
mesLeds121110.write(X[7],Y[2],HIGH);
mesLeds121110.write(X[7],Y[3],HIGH);
mesLeds121110.write(X[7],Y[4],HIGH);
mesLeds121110.write(X[7],Y[5],HIGH);
mesLeds121110.write(X[7],Y[6],HIGH);

mesLeds121110.write(X[6],Y[1],HIGH);
mesLeds121110.write(X[6],Y[2],HIGH);
mesLeds121110.write(X[6],Y[3],HIGH);
mesLeds121110.write(X[6],Y[4],HIGH);
mesLeds121110.write(X[6],Y[5],HIGH);
mesLeds121110.write(X[6],Y[6],HIGH);

mesLeds121110.write(X[4],Y[1],HIGH);
mesLeds121110.write(X[4],Y[2],HIGH);
mesLeds121110.write(X[4],Y[3],HIGH);
mesLeds121110.write(X[4],Y[4],HIGH);
mesLeds121110.write(X[4],Y[5],HIGH);
mesLeds121110.write(X[4],Y[6],HIGH);

mesLeds121110.write(X[3],Y[1],HIGH);
mesLeds121110.write(X[3],Y[2],HIGH);
mesLeds121110.write(X[3],Y[3],HIGH);
mesLeds121110.write(X[3],Y[4],HIGH);
mesLeds121110.write(X[3],Y[5],HIGH);
mesLeds121110.write(X[3],Y[6],HIGH);

mesLeds121110.write(X[1],Y[1],HIGH);
mesLeds121110.write(X[1],Y[2],HIGH);
mesLeds121110.write(X[1],Y[3],HIGH);
mesLeds121110.write(X[1],Y[4],HIGH);
mesLeds121110.write(X[1],Y[5],HIGH);
mesLeds121110.write(X[1],Y[6],HIGH);

mesLeds121110.write(X[0],Y[1],HIGH);
mesLeds121110.write(X[0],Y[2],HIGH);
mesLeds121110.write(X[0],Y[3],HIGH);
mesLeds121110.write(X[0],Y[4],HIGH);
mesLeds121110.write(X[0],Y[5],HIGH);
mesLeds121110.write(X[0],Y[6],HIGH);

mesLeds121110.write(X[2],Y[5],HIGH);
mesLeds121110.write(X[2],Y[6],HIGH);

mesLeds121110.write(X[5],Y[5],HIGH);
mesLeds121110.write(X[5],Y[6],HIGH);

delay( 600 );
digitalWrite( 5 , LOW );

}


if (( ( fehler ) == ( 4 ) ))
{

mesLeds121110.write(X[7],Y[1],HIGH);
mesLeds121110.write(X[6],Y[1],HIGH);
mesLeds121110.write(X[5],Y[1],HIGH);
mesLeds121110.write(X[4],Y[1],HIGH);
mesLeds121110.write(X[3],Y[1],HIGH);
mesLeds121110.write(X[2],Y[1],HIGH);

mesLeds121110.write(X[7],Y[2],HIGH);
mesLeds121110.write(X[6],Y[2],HIGH);
mesLeds121110.write(X[5],Y[2],HIGH);
mesLeds121110.write(X[4],Y[2],HIGH);
mesLeds121110.write(X[3],Y[2],HIGH);
mesLeds121110.write(X[2],Y[2],HIGH);

mesLeds121110.write(X[0],Y[5],HIGH);
mesLeds121110.write(X[1],Y[5],HIGH);
mesLeds121110.write(X[2],Y[5],HIGH);
mesLeds121110.write(X[3],Y[5],HIGH);

mesLeds121110.write(X[0],Y[4],HIGH);
mesLeds121110.write(X[1],Y[4],HIGH);
mesLeds121110.write(X[2],Y[4],HIGH);
mesLeds121110.write(X[3],Y[4],HIGH);
mesLeds121110.write(X[3],Y[5],HIGH);

mesLeds121110.write(X[2],Y[3],HIGH);
mesLeds121110.write(X[3],Y[3],HIGH);

mesLeds121110.write(X[4],Y[4],HIGH);
mesLeds121110.write(X[4],Y[5],HIGH);

mesLeds121110.write(X[2],Y[6],HIGH);
mesLeds121110.write(X[3],Y[6],HIGH);

delay( 600 );
digitalWrite( 5 , LOW );

}

if (( ( fehler ) == ( 5 ) ))
{

mesLeds121110.write(X[7],Y[1],HIGH);
mesLeds121110.write(X[7],Y[2],HIGH);
mesLeds121110.write(X[7],Y[3],HIGH);
mesLeds121110.write(X[7],Y[4],HIGH);
mesLeds121110.write(X[7],Y[5],HIGH);
mesLeds121110.write(X[7],Y[6],HIGH);

mesLeds121110.write(X[6],Y[1],HIGH);
mesLeds121110.write(X[6],Y[2],HIGH);
mesLeds121110.write(X[6],Y[3],HIGH);
mesLeds121110.write(X[6],Y[4],HIGH);
mesLeds121110.write(X[6],Y[5],HIGH);
mesLeds121110.write(X[6],Y[6],HIGH);

mesLeds121110.write(X[4],Y[1],HIGH);
mesLeds121110.write(X[4],Y[2],HIGH);
mesLeds121110.write(X[4],Y[3],HIGH);
mesLeds121110.write(X[4],Y[4],HIGH);
mesLeds121110.write(X[4],Y[5],HIGH);
mesLeds121110.write(X[4],Y[6],HIGH);

mesLeds121110.write(X[3],Y[1],HIGH);
mesLeds121110.write(X[3],Y[2],HIGH);
mesLeds121110.write(X[3],Y[3],HIGH);
mesLeds121110.write(X[3],Y[4],HIGH);
mesLeds121110.write(X[3],Y[5],HIGH);
mesLeds121110.write(X[3],Y[6],HIGH);

mesLeds121110.write(X[1],Y[1],HIGH);
mesLeds121110.write(X[1],Y[2],HIGH);
mesLeds121110.write(X[1],Y[3],HIGH);
mesLeds121110.write(X[1],Y[4],HIGH);
mesLeds121110.write(X[1],Y[5],HIGH);
mesLeds121110.write(X[1],Y[6],HIGH);

mesLeds121110.write(X[0],Y[1],HIGH);
mesLeds121110.write(X[0],Y[2],HIGH);
mesLeds121110.write(X[0],Y[3],HIGH);
mesLeds121110.write(X[0],Y[4],HIGH);
mesLeds121110.write(X[0],Y[5],HIGH);
mesLeds121110.write(X[0],Y[6],HIGH);

mesLeds121110.write(X[2],Y[5],HIGH);
mesLeds121110.write(X[2],Y[6],HIGH);

mesLeds121110.write(X[5],Y[1],HIGH);
mesLeds121110.write(X[5],Y[2],HIGH);

delay( 600 );
digitalWrite( 5 , LOW );

}


if (( ( fehler ) == ( 6 ) ))
{

mesLeds121110.write(X[7],Y[1],HIGH);
mesLeds121110.write(X[7],Y[2],HIGH);
mesLeds121110.write(X[7],Y[3],HIGH);
mesLeds121110.write(X[7],Y[4],HIGH);
mesLeds121110.write(X[7],Y[5],HIGH);
mesLeds121110.write(X[7],Y[6],HIGH);

mesLeds121110.write(X[6],Y[1],HIGH);
mesLeds121110.write(X[6],Y[2],HIGH);
mesLeds121110.write(X[6],Y[3],HIGH);
mesLeds121110.write(X[6],Y[4],HIGH);
mesLeds121110.write(X[6],Y[5],HIGH);
mesLeds121110.write(X[6],Y[6],HIGH);

mesLeds121110.write(X[4],Y[1],HIGH);
mesLeds121110.write(X[4],Y[2],HIGH);
mesLeds121110.write(X[4],Y[3],HIGH);
mesLeds121110.write(X[4],Y[4],HIGH);
mesLeds121110.write(X[4],Y[5],HIGH);
mesLeds121110.write(X[4],Y[6],HIGH);

mesLeds121110.write(X[3],Y[1],HIGH);
mesLeds121110.write(X[3],Y[2],HIGH);
mesLeds121110.write(X[3],Y[3],HIGH);
mesLeds121110.write(X[3],Y[4],HIGH);
mesLeds121110.write(X[3],Y[5],HIGH);
mesLeds121110.write(X[3],Y[6],HIGH);

mesLeds121110.write(X[1],Y[1],HIGH);
mesLeds121110.write(X[1],Y[2],HIGH);
mesLeds121110.write(X[1],Y[3],HIGH);
mesLeds121110.write(X[1],Y[4],HIGH);
mesLeds121110.write(X[1],Y[5],HIGH);
mesLeds121110.write(X[1],Y[6],HIGH);

mesLeds121110.write(X[0],Y[1],HIGH);
mesLeds121110.write(X[0],Y[2],HIGH);
mesLeds121110.write(X[0],Y[3],HIGH);
mesLeds121110.write(X[0],Y[4],HIGH);
mesLeds121110.write(X[0],Y[5],HIGH);
mesLeds121110.write(X[0],Y[6],HIGH);

mesLeds121110.write(X[2],Y[5],HIGH);
mesLeds121110.write(X[2],Y[6],HIGH);

mesLeds121110.write(X[5],Y[1],HIGH);
mesLeds121110.write(X[5],Y[2],HIGH);

mesLeds121110.write(X[2],Y[1],HIGH);
mesLeds121110.write(X[2],Y[2],HIGH);

delay( 600 );
digitalWrite( 5 , LOW );

}

if (( ( fehler ) == ( 7 ) ))
{

mesLeds121110.write(X[0],Y[3],HIGH);
mesLeds121110.write(X[1],Y[3],HIGH);
mesLeds121110.write(X[2],Y[4],HIGH);
mesLeds121110.write(X[3],Y[4],HIGH);
mesLeds121110.write(X[4],Y[5],HIGH);
mesLeds121110.write(X[5],Y[5],HIGH);
mesLeds121110.write(X[6],Y[5],HIGH);
mesLeds121110.write(X[7],Y[5],HIGH);

mesLeds121110.write(X[0],Y[4],HIGH);
mesLeds121110.write(X[1],Y[4],HIGH);
mesLeds121110.write(X[2],Y[5],HIGH);
mesLeds121110.write(X[3],Y[5],HIGH);
mesLeds121110.write(X[4],Y[6],HIGH);
mesLeds121110.write(X[5],Y[6],HIGH);
mesLeds121110.write(X[6],Y[6],HIGH);
mesLeds121110.write(X[7],Y[6],HIGH);

mesLeds121110.write(X[6],Y[1],HIGH);
mesLeds121110.write(X[6],Y[2],HIGH);
mesLeds121110.write(X[6],Y[3],HIGH);
mesLeds121110.write(X[6],Y[4],HIGH);
mesLeds121110.write(X[6],Y[5],HIGH);

mesLeds121110.write(X[7],Y[1],HIGH);
mesLeds121110.write(X[7],Y[2],HIGH);
mesLeds121110.write(X[7],Y[3],HIGH);
mesLeds121110.write(X[7],Y[4],HIGH);
mesLeds121110.write(X[7],Y[5],HIGH);


delay( 600 );
digitalWrite( 5 , LOW );

}



if (( ( fehler ) == ( 8 ) ))
{

mesLeds121110.write(X[7],Y[1],HIGH);
mesLeds121110.write(X[7],Y[2],HIGH);
mesLeds121110.write(X[7],Y[3],HIGH);
mesLeds121110.write(X[7],Y[4],HIGH);
mesLeds121110.write(X[7],Y[5],HIGH);
mesLeds121110.write(X[7],Y[6],HIGH);

mesLeds121110.write(X[6],Y[1],HIGH);
mesLeds121110.write(X[6],Y[2],HIGH);
mesLeds121110.write(X[6],Y[3],HIGH);
mesLeds121110.write(X[6],Y[4],HIGH);
mesLeds121110.write(X[6],Y[5],HIGH);
mesLeds121110.write(X[6],Y[6],HIGH);

mesLeds121110.write(X[4],Y[1],HIGH);
mesLeds121110.write(X[4],Y[2],HIGH);
mesLeds121110.write(X[4],Y[3],HIGH);
mesLeds121110.write(X[4],Y[4],HIGH);
mesLeds121110.write(X[4],Y[5],HIGH);
mesLeds121110.write(X[4],Y[6],HIGH);

mesLeds121110.write(X[3],Y[1],HIGH);
mesLeds121110.write(X[3],Y[2],HIGH);
mesLeds121110.write(X[3],Y[3],HIGH);
mesLeds121110.write(X[3],Y[4],HIGH);
mesLeds121110.write(X[3],Y[5],HIGH);
mesLeds121110.write(X[3],Y[6],HIGH);

mesLeds121110.write(X[1],Y[1],HIGH);
mesLeds121110.write(X[1],Y[2],HIGH);
mesLeds121110.write(X[1],Y[3],HIGH);
mesLeds121110.write(X[1],Y[4],HIGH);
mesLeds121110.write(X[1],Y[5],HIGH);
mesLeds121110.write(X[1],Y[6],HIGH);

mesLeds121110.write(X[0],Y[1],HIGH);
mesLeds121110.write(X[0],Y[2],HIGH);
mesLeds121110.write(X[0],Y[3],HIGH);
mesLeds121110.write(X[0],Y[4],HIGH);
mesLeds121110.write(X[0],Y[5],HIGH);
mesLeds121110.write(X[0],Y[6],HIGH);

mesLeds121110.write(X[2],Y[5],HIGH);
mesLeds121110.write(X[2],Y[6],HIGH);

mesLeds121110.write(X[5],Y[1],HIGH);
mesLeds121110.write(X[5],Y[2],HIGH);

mesLeds121110.write(X[2],Y[1],HIGH);
mesLeds121110.write(X[2],Y[2],HIGH);

mesLeds121110.write(X[5],Y[5],HIGH);
mesLeds121110.write(X[5],Y[6],HIGH);

delay( 600 );
digitalWrite( 5 , LOW );

}


if (( ( fehler ) == ( 9 ) ))
{

mesLeds121110.write(X[7],Y[1],HIGH);
mesLeds121110.write(X[7],Y[2],HIGH);
mesLeds121110.write(X[7],Y[3],HIGH);
mesLeds121110.write(X[7],Y[4],HIGH);
mesLeds121110.write(X[7],Y[5],HIGH);
mesLeds121110.write(X[7],Y[6],HIGH);

mesLeds121110.write(X[6],Y[1],HIGH);
mesLeds121110.write(X[6],Y[2],HIGH);
mesLeds121110.write(X[6],Y[3],HIGH);
mesLeds121110.write(X[6],Y[4],HIGH);
mesLeds121110.write(X[6],Y[5],HIGH);
mesLeds121110.write(X[6],Y[6],HIGH);

mesLeds121110.write(X[4],Y[1],HIGH);
mesLeds121110.write(X[4],Y[2],HIGH);
mesLeds121110.write(X[4],Y[3],HIGH);
mesLeds121110.write(X[4],Y[4],HIGH);
mesLeds121110.write(X[4],Y[5],HIGH);
mesLeds121110.write(X[4],Y[6],HIGH);

mesLeds121110.write(X[3],Y[1],HIGH);
mesLeds121110.write(X[3],Y[2],HIGH);
mesLeds121110.write(X[3],Y[3],HIGH);
mesLeds121110.write(X[3],Y[4],HIGH);
mesLeds121110.write(X[3],Y[5],HIGH);
mesLeds121110.write(X[3],Y[6],HIGH);

mesLeds121110.write(X[1],Y[1],HIGH);
mesLeds121110.write(X[1],Y[2],HIGH);
mesLeds121110.write(X[1],Y[3],HIGH);
mesLeds121110.write(X[1],Y[4],HIGH);
mesLeds121110.write(X[1],Y[5],HIGH);
mesLeds121110.write(X[1],Y[6],HIGH);

mesLeds121110.write(X[0],Y[1],HIGH);
mesLeds121110.write(X[0],Y[2],HIGH);
mesLeds121110.write(X[0],Y[3],HIGH);
mesLeds121110.write(X[0],Y[4],HIGH);
mesLeds121110.write(X[0],Y[5],HIGH);
mesLeds121110.write(X[0],Y[6],HIGH);

mesLeds121110.write(X[2],Y[5],HIGH);
mesLeds121110.write(X[2],Y[6],HIGH);

mesLeds121110.write(X[5],Y[1],HIGH);
mesLeds121110.write(X[5],Y[2],HIGH);

mesLeds121110.write(X[5],Y[5],HIGH);
mesLeds121110.write(X[5],Y[6],HIGH);

delay( 600 );
digitalWrite( 5 , LOW );
delay( 32000 );
delay( 32000 );
delay( 32000 );
delay( 32000 );
delay( 32000 );
delay( 32000 );
delay( 32000 );
delay( 32000 );
delay( 32000 );
}

}
}


void Unterprogramm0()
{
mesLeds121110.write(X[0],Y[0],LOW);
mesLeds121110.write(X[0],Y[1],LOW);
mesLeds121110.write(X[0],Y[2],LOW);
mesLeds121110.write(X[0],Y[3],LOW);
mesLeds121110.write(X[0],Y[4],LOW);
mesLeds121110.write(X[0],Y[5],LOW);
mesLeds121110.write(X[0],Y[6],LOW);
mesLeds121110.write(X[0],Y[7],LOW);

mesLeds121110.write(X[1],Y[0],LOW);
mesLeds121110.write(X[1],Y[1],LOW);
mesLeds121110.write(X[1],Y[2],LOW);
mesLeds121110.write(X[1],Y[3],LOW);
mesLeds121110.write(X[1],Y[4],LOW);
mesLeds121110.write(X[1],Y[5],LOW);
mesLeds121110.write(X[1],Y[6],LOW);
mesLeds121110.write(X[1],Y[7],LOW);

mesLeds121110.write(X[2],Y[0],LOW);
mesLeds121110.write(X[2],Y[1],LOW);
mesLeds121110.write(X[2],Y[2],LOW);
mesLeds121110.write(X[2],Y[3],LOW);
mesLeds121110.write(X[2],Y[4],LOW);
mesLeds121110.write(X[2],Y[5],LOW);
mesLeds121110.write(X[2],Y[6],LOW);
mesLeds121110.write(X[2],Y[7],LOW);

mesLeds121110.write(X[3],Y[0],LOW);
mesLeds121110.write(X[3],Y[1],LOW);
mesLeds121110.write(X[3],Y[2],LOW);
mesLeds121110.write(X[3],Y[3],LOW);
mesLeds121110.write(X[3],Y[4],LOW);
mesLeds121110.write(X[3],Y[5],LOW);
mesLeds121110.write(X[3],Y[6],LOW);
mesLeds121110.write(X[3],Y[7],LOW);

mesLeds121110.write(X[4],Y[0],LOW);
mesLeds121110.write(X[4],Y[1],LOW);
mesLeds121110.write(X[4],Y[2],LOW);
mesLeds121110.write(X[4],Y[3],LOW);
mesLeds121110.write(X[4],Y[4],LOW);
mesLeds121110.write(X[4],Y[5],LOW);
mesLeds121110.write(X[4],Y[6],LOW);
mesLeds121110.write(X[4],Y[7],LOW);

mesLeds121110.write(X[5],Y[0],LOW);
mesLeds121110.write(X[5],Y[1],LOW);
mesLeds121110.write(X[5],Y[2],LOW);
mesLeds121110.write(X[5],Y[3],LOW);
mesLeds121110.write(X[5],Y[4],LOW);
mesLeds121110.write(X[5],Y[5],LOW);
mesLeds121110.write(X[5],Y[6],LOW);
mesLeds121110.write(X[5],Y[7],LOW);

mesLeds121110.write(X[6],Y[0],LOW);
mesLeds121110.write(X[6],Y[1],LOW);
mesLeds121110.write(X[6],Y[2],LOW);
mesLeds121110.write(X[6],Y[3],LOW);
mesLeds121110.write(X[6],Y[4],LOW);
mesLeds121110.write(X[6],Y[5],LOW);
mesLeds121110.write(X[6],Y[6],LOW);
mesLeds121110.write(X[6],Y[7],LOW);

mesLeds121110.write(X[7],Y[0],LOW);
mesLeds121110.write(X[7],Y[1],LOW);
mesLeds121110.write(X[7],Y[2],LOW);
mesLeds121110.write(X[7],Y[3],LOW);
mesLeds121110.write(X[7],Y[4],LOW);
mesLeds121110.write(X[7],Y[5],LOW);
mesLeds121110.write(X[7],Y[6],LOW);
mesLeds121110.write(X[7],Y[7],LOW);

}

heisser draht ohne betrügen mit 3 led grün gelb rot und arduino

 

heisser draht ohne betreugen led rot gruen

 

--------------------------------------------------------

int spiel = 0 ;
int ersterstart = 0 ;

void setup()
{
pinMode( 3 , INPUT);
pinMode( 5 , INPUT);
pinMode( 4 , INPUT);
digitalWrite(3, HIGH);
digitalWrite(4, HIGH);
digitalWrite(5, HIGH);
pinMode( 10 , OUTPUT);
pinMode( 11 , OUTPUT);
pinMode( 12 , OUTPUT);
Serial.begin(9600);

spiel = 0 ;

ersterstart = 0 ;

digitalWrite( 10 , LOW );

digitalWrite( 11 , HIGH );

digitalWrite( 12 , LOW );

}

void loop()
{
if (( !( digitalRead(3) ) && ( ( ersterstart ) == ( 0 ) ) ))
{
spiel = ( spiel + 1 ) ;
ersterstart = ( ersterstart + 10 ) ;
digitalWrite( 11 , LOW );
digitalWrite( 12 , HIGH );
}
Serial.print("spiel gesperrt");
Serial.println();
while ( ( !( digitalRead(4) ) && ( ( spiel ) == ( 1 ) ) ) )
{
spiel = ( spiel + 1 ) ;
while ( ( ( spiel ) == ( 2 ) ) )
{
digitalWrite( 12 , LOW );
digitalWrite( 11 , HIGH );
if (!( digitalRead(3) ))
{
spiel = 1 ;
digitalWrite( 12 , HIGH );
digitalWrite( 11 , LOW );
}
Serial.print("spiel gesperrt");
Serial.println();
}

}

while ( ( !( digitalRead(5) ) && ( ( spiel ) == ( 1 ) ) ) )
{
spiel = ( spiel + 1 ) ;
while ( ( ( spiel ) == ( 2 ) ) )
{
digitalWrite( 10 , HIGH );
digitalWrite( 11 , LOW );
digitalWrite( 12 , LOW );
if (!( digitalRead(3) ))
{
spiel = 1 ;
digitalWrite( 12 , HIGH );
digitalWrite( 11 , LOW );
digitalWrite( 10 , LOW );
}
Serial.print("spiel gemeistert");
Serial.println();
}

}

}

Vielen dank für ihre Bestellung

Sie erhalten in den nächsten Tagen eine e-mail mit der Rechnung für ihre Bestellung. Bitte überweisen sie den Betrag auf das auf der Rechnung angegeben Konto. Mit der Überweisung ist der Kaufvertrag dann zustande gekommen und ich versende so schnell wie möglich aber innerhalb von 10 Werktagen die Schaltung oder das Spiel an sie. 

Wenn sie ein Angebot oder eine Frage abgesendet haben erhalten sie ebenfalls in den nächsten Tage eine Antwort oder ein konkretes Angebot. 

Viele Grüße ihr Team von kreativekiste.de

 

Hier geht es zur Startseite von KreativeKiste.de

 

Hier geht es zur Heißen-Draht-Manufaktur.de

 

 

heisser draht mit Neo Pixel für Arduino

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();
}
}

heisser Draht one chance arduino code

 

hot wire game heisser draht led summer reset

 

 

int a;

void setup()
{
pinMode( 4 , INPUT);
pinMode( 1 , OUTPUT);
pinMode( 0 , OUTPUT);
pinMode( 1 , OUTPUT);
pinMode( 2 , OUTPUT);
pinMode( 0 , OUTPUT);
analogWrite(0 , 115);

digitalWrite( 1 , LOW );

digitalWrite( 2 , LOW );

}

void loop()
{
if (digitalRead(4))
{
digitalWrite( 0 , LOW );
analogWrite(1 , 115);
digitalWrite( 2 , HIGH );
delay( 1500 );
digitalWrite( 2 , LOW );
for (a=1; a<= ( 32000 ); ++a )
{
delay( 32000 );
delay( 32000 );
}
}
delay( 1 );
}

heisser-draht-fehler-led-summer-code

 

hot wire game play build

 

 

void setup()
{
pinMode( 0 , INPUT);
pinMode( 1 , OUTPUT);
pinMode( 1 , OUTPUT);
pinMode( 2 , OUTPUT);
analogWrite(1 , 150);

delay( 300 );

digitalWrite( 1 , LOW );

delay( 300 );

analogWrite(1 , 150);

delay( 300 );

digitalWrite( 1 , LOW );

delay( 300 );

}

void loop()
{
if (digitalRead(0))
{
analogWrite(1 , 150);
digitalWrite( 2 , HIGH );
delay( 900 );
digitalWrite( 1 , LOW );
digitalWrite( 2 , LOW );
}
delay( 2 );
}

heißer Draht mit sieben Segment Anzeige bauen Code

heisser draht mit attiny 44 sieben segmentanzeige



int fehler = 0 ; void setup() { pinMode( 7 , INPUT); pinMode( 9 , OUTPUT); pinMode( 10 , OUTPUT); pinMode( 0 , OUTPUT); pinMode( 1 , OUTPUT); pinMode( 2 , OUTPUT); pinMode( 3 , OUTPUT); pinMode( 4 , OUTPUT); pinMode( 5 , OUTPUT); pinMode( 6 , OUTPUT); fehler = 0 ; } void loop() { if ( digitalRead( 7)) { fehler = ( fehler + 1 ) ; delay( 5 ); digitalWrite( 9 , HIGH ); digitalWrite( 10 , HIGH ); delay( 1000 ); digitalWrite( 9 , LOW ); digitalWrite( 10 , LOW ); } if (( ( fehler ) == ( 0 ) )) { digitalWrite( 0 , LOW ); digitalWrite( 1 , LOW ); digitalWrite( 2 , HIGH ); digitalWrite( 3 , LOW ); digitalWrite( 4 , LOW ); digitalWrite( 5 , LOW ); digitalWrite( 6 , LOW ); delay( 10 ); } if (( ( fehler ) == ( 1 ) )) { digitalWrite( 0 , HIGH ); digitalWrite( 1 , LOW ); digitalWrite( 2 , HIGH ); digitalWrite( 3 , LOW ); digitalWrite( 4 , HIGH ); digitalWrite( 5 , HIGH ); digitalWrite( 6 , HIGH ); delay( 5 ); } if (( ( fehler ) == ( 2 ) )) { digitalWrite( 0 , LOW ); digitalWrite( 1 , HIGH ); digitalWrite( 2 , LOW ); digitalWrite( 3 , LOW ); digitalWrite( 4 , LOW ); digitalWrite( 5 , HIGH ); digitalWrite( 6 , LOW ); delay( 5 ); } if (( ( fehler ) == ( 3 ) )) { digitalWrite( 0 , LOW ); digitalWrite( 1 , LOW ); digitalWrite( 2 , LOW ); digitalWrite( 3 , LOW ); digitalWrite( 4 , HIGH ); digitalWrite( 5 , HIGH ); digitalWrite( 6 , LOW ); delay( 10 ); } if (( ( fehler ) == ( 4 ) )) { digitalWrite( 0 , HIGH ); digitalWrite( 1 , LOW ); digitalWrite( 2 , LOW ); digitalWrite( 3 , LOW ); digitalWrite( 4 , HIGH ); digitalWrite( 5 , LOW ); digitalWrite( 6 , HIGH ); delay( 5 ); } if (( ( fehler ) == ( 5 ) )) { digitalWrite( 0 , LOW ); digitalWrite( 1 , LOW ); digitalWrite( 2 , LOW ); digitalWrite( 3 , HIGH ); digitalWrite( 4 , HIGH ); digitalWrite( 5 , LOW ); digitalWrite( 6 , LOW ); delay( 5 ); } if (( ( fehler ) == ( 6 ) )) { digitalWrite( 0 , LOW ); digitalWrite( 1 , LOW ); digitalWrite( 2 , LOW ); digitalWrite( 3 , HIGH ); digitalWrite( 4 , LOW ); digitalWrite( 5 , LOW ); digitalWrite( 6 , LOW ); delay( 10 ); } if (( ( fehler ) == ( 7 ) )) { digitalWrite( 0 , HIGH ); digitalWrite( 1 , LOW ); digitalWrite( 2 , HIGH ); digitalWrite( 3 , LOW ); digitalWrite( 4 , HIGH ); digitalWrite( 5 , HIGH ); digitalWrite( 6 , LOW ); delay( 5 ); } if (( ( fehler ) == ( 8 ) )) { digitalWrite( 0 , LOW ); digitalWrite( 1 , LOW ); digitalWrite( 2 , LOW ); digitalWrite( 3 , LOW ); digitalWrite( 4 , LOW ); digitalWrite( 5 , LOW ); digitalWrite( 6 , LOW ); delay( 5 ); } if (( ( fehler ) == ( 9 ) )) { digitalWrite( 0 , LOW ); digitalWrite( 1 , LOW ); digitalWrite( 2 , LOW ); digitalWrite( 3 , LOW ); digitalWrite( 4 , HIGH ); digitalWrite( 5 , LOW ); digitalWrite( 6 , LOW ); delay( 10 ); } if (( ( fehler ) == ( 10 ) )) { digitalWrite( 0 , LOW ); digitalWrite( 1 , LOW ); digitalWrite( 2 , HIGH ); digitalWrite( 3 , LOW ); digitalWrite( 4 , LOW ); digitalWrite( 5 , LOW ); digitalWrite( 6 , LOW ); delay( 5 ); VAR_1_fehler = 0 ; digitalWrite( 9 , HIGH ); digitalWrite( 10 , HIGH ); delay( 3000 ); digitalWrite( 9 , LOW ); digitalWrite( 10 , LOW ); } }

heißer Draht mit LCD Display Fehler und Zeit Messung

// software for http://www.kreativekiste.de/elektro/dem-heissen-draht-auf-der-spur
// developed by Timo Denk (Nov 2014)
//
// wiring:
// 0: start
// 1: stop
// 2: mistake
// 3: buzzer
// A0: penalty time
// A4: display SDA
// A5: display SCL

// libraries
#include <Wire.h>
#include <LiquidCrystal_I2C.h>

LiquidCrystal_I2C lcd(0x3F,20,4);

const byte startPin = 0, stopPin = 1, mistakePin = 2, buzzerPin = 3, penaltyTimePin = A0;
const byte minPenaltyTime = 1, maxPenaltyTime = 17; // [t] = 1 s

const String penaltyTimeString = "Fehler", finalTimeString = "Endzeit", timeString = "Zeit", commercialString = "www.kreativekiste.de", mistakeString = "Berührt!!!", totalTime = "Gesamtzeit";

long millisStart, millisEnd;

int mistakes, penaltyTime, lastPenaltyTime;

void setup() {
lcd.init();
lcd.backlight();

pinMode(startPin, INPUT);
pinMode(stopPin, INPUT);
pinMode(mistakePin, INPUT);
pinMode(buzzerPin, OUTPUT);
digitalWrite(buzzerPin, LOW);
digitalWrite(startPin, HIGH);
digitalWrite(stopPin, HIGH);
digitalWrite(mistakePin, HIGH);
}

void loop() {
clearScreen();
printStringCenter(1, "Heisser Draht");

printStringCenter(2, "Strafzeit einstellen");
lastPenaltyTime = 0, penaltyTime = 0;
// waiting for game to start
while (digitalRead(startPin) == HIGH) {
penaltyTime = (byte)round(map(analogRead(penaltyTimePin), 0, 1023, minPenaltyTime, maxPenaltyTime));
if (penaltyTime != lastPenaltyTime) {
clearRow(3);
printStringCenter(3, String(penaltyTime) + " s");
lastPenaltyTime = penaltyTime;
}
}

// game running
millisStart = millis();
clearScreen();
mistakes = 0;
while (digitalRead(stopPin) == HIGH) {
// check for mistakes
printStatusOnScreen();
if (digitalRead(mistakePin) == LOW) {
mistakes++;
digitalWrite(buzzerPin, HIGH);
printStatusOnScreen();
delay(500);
digitalWrite(buzzerPin, LOW);
}
delay(10);
}

// game finished
millisEnd = millis();
clearScreen();
clearRow(0);
printStringCenter(0, "Spiel beendet!");
printStatusOnScreen();
delay(10000);
}

void printStatusOnScreen() {
int playingTime = round((millis() - millisStart)/1000), penaltyTimeSum = mistakes * penaltyTime;
printStringCenter(1, "Spielzeit: " + sec2MinSecString(playingTime));
printStringCenter(2, "Fehler: " + String(mistakes) + " x " + String(penaltyTime) + "s");
printStringCenter(3, "Gesamt: " + sec2MinSecString(playingTime + penaltyTimeSum));
}

void showCommercial() {
clearRow(0);
printStringCenter(0, commercialString);
}

void clearScreen() {
for (byte i = 0; i < 4; i++)
clearRow(i);

showCommercial();
}

void printStringCenter(byte row, String string) {
lcd.setCursor((int)((20 - string.length()) / 2), row);
lcd.print(string);
}

void clearRow(byte row) {
lcd.setCursor(0, row);
lcd.print(" ");
}

String sec2MinSecString(int input) { // converts seconds to a string like "minutes:seconds"
String minutes = String((int)(input / 60));
String seconds = String(input % 60);
if (seconds.length() == 1)
seconds = "0" + seconds;
//if (minutes.length() == 1)
// minutes = "0" + minutes;
return minutes + ":" + seconds + " ";
}

8x7 Segment Anzeige MAX7219CWG Stoppuhr Counter heißer Draht

Heißer Draht Code mit Stoppuhr (8-Stellige 7-Segmentanzeige mit serieller Ansteuerung (MAX7219), Arduino komp.) und Summer.

heisser draht mit stoppuhr bauanleitung

 

 

// code by:   Hugo T. 

 

#include "LedControl.h"
LedControl lc = LedControl(12, 11, 10,1 );

const int buttonPin = 2;    // Start, Stopp, Reset PIN
const int failurePin = 4;    // Fehler PIN
const int beeepPin = 13;  // Summer Pin (je nach Summer über einen Transitor)

void setup() {
lc.shutdown(0, false);
lc.clearDisplay(0);
lc.setIntensity(0, 15);

// initialize the pushbutton pin as an input:
pinMode(buttonPin, INPUT);
pinMode(failurePin, INPUT);
pinMode(beeepPin, OUTPUT);
}

void printDashes() {

lc.setChar(0, 0, '-', false);
lc.setChar(0, 1, '-', false);
lc.setChar(0, 2, '-', false);
lc.setChar(0, 3, '-', false);
lc.setChar(0, 4, '-', false);
lc.setChar(0, 5, '-', false);
lc.setChar(0, 6, '-', false);
lc.setChar(0, 7, '-', false);

}
void blink(int times)
{


for (int i = 0; i < times; i++) {

lc.setScanLimit(0, 7);
lc.clearDisplay(0);

printDashes();

delay(150);
lc.clearDisplay(0);

lc.setScanLimit(0, 0);
delay(150);
}


}

void countdown(int counter)
{

while (counter >= 0)
{

int maxDigit = 0;

int n = counter;
for (int i = 0; i < 8; i++) {
int digit = n % 10;
n = n / 10;

lc.setDigit(0, i, digit, false);
if (digit)
{
maxDigit = i;
}
}

lc.setScanLimit(0, maxDigit);

delay(500);
lc.clearDisplay(0);
delay(100);

counter--;
}

}

void displayNumbers(int counter, int seconds, int minutes)
{
int maxDigit = 0;

showTime(counter, 0);
showTime(seconds, 3);
showTime(minutes, 6);

lc.setChar(0, 2, '-', false);
lc.setChar(0, 5, '-', false);


}

void showTime(int value, int positionStart) {
int maxDigit = 0;
int n = value;
int positionEnd = positionStart+2;
for (int i = positionStart; i < positionEnd; i++) {
int digit = n % 10;
n = n / 10;

lc.setDigit(0, i, digit, false);
if (digit)
{
maxDigit = i;
}
}

}

int counter = 0;
int seconds = 0;
int minutes = 0;
int didStart = 0;
int startButtonState = 0;
int failureButtonState = 0;

void loop() {
if (counter > 100) {
counter = 0;
seconds++;
}

if (seconds > 60) {
seconds = 0;
minutes++;
}

displayNumbers(counter, seconds, minutes);
startButtonState = digitalRead(buttonPin);
failureButtonState = digitalRead(failurePin);

if (didStart == 1 | startButtonState == 1)
{
if (didStart == 0) {
digitalWrite(beeepPin, HIGH);
}

if (seconds > 1) {
digitalWrite(beeepPin, LOW);
}

didStart = 1;

if (seconds > 1 & startButtonState == 1)
{
digitalWrite(beeepPin, HIGH);
delay(1500);
digitalWrite(beeepPin, LOW);
do
{
startButtonState = digitalRead(buttonPin);
} while (startButtonState == 0 );
counter = 0;
seconds = 0;
minutes = 0;
displayNumbers(counter, seconds, minutes);
didStart = 0;
delay(200);
}

if(failureButtonState == 1){
counter = 0;
seconds = 0;
minutes = 0;
displayNumbers(counter, seconds, minutes);
didStart = 0;
digitalWrite(beeepPin, HIGH);
delay(3000);
digitalWrite(beeepPin, LOW);
}

if (didStart != 0) {
delay(10);
lc.clearDisplay(0);
counter++;
}
}

//lc.clearDisplay(0);
}

99 Sekunden Timer für einen Attiny attiny 2013, heißer draht

99 SEKUNDEN Timer für einen heißen Draht. Die Verdrahtung eurer sieben Segment Anzeige entnehmt ihr bitte aus dem Datenblatt und gleicht mit (void set1(byte value)) für die erste und (void set10(byte value) für die zweite stelle ab. 

 heiser draht mit countdown anzeige bauen 

Arduino Code:

------------------------------------------------------------------------------------

const byte startStopPin = 0, mistakePin = 1, buzzerPin = 16;

long startMillis;

void setup()
{
pinMode(2, OUTPUT);
pinMode(3, OUTPUT);
pinMode(4, OUTPUT);
pinMode(5, OUTPUT);
pinMode(6, OUTPUT);
pinMode(7, OUTPUT);
pinMode(8, OUTPUT);
pinMode(9, OUTPUT);
pinMode(10, OUTPUT);
pinMode(11, OUTPUT);
pinMode(12, OUTPUT);
pinMode(13, OUTPUT);
pinMode(14, OUTPUT);
pinMode(15, OUTPUT);

pinMode(startStopPin, INPUT);
pinMode(mistakePin, INPUT);
pinMode(buzzerPin, OUTPUT);

displayNumber(0);
while(digitalRead(startStopPin) == LOW) // wait for the start signal
{ ; }

startMillis = millis();
}

void loop()
{
long number = 99 - (millis() - startMillis) / 1000;

if (number <= 0)
{
gameOver();
}

if (digitalRead(startStopPin) == HIGH && (millis() - startMillis) > 2000)
{
while(true)
{ ; }
}

if (digitalRead(mistakePin) == HIGH && (millis() - startMillis) > 2000)
{
gameOver();
}


displayNumber(number);
}

void displayNumber(byte x)
{
x %= 100;
set1(~dec27(x % 10));
set10(~dec27(x / 10));
}

void set1(byte value)
{
digitalWrite(2, bitRead(value, 0)); // segment a
digitalWrite(3, bitRead(value, 1)); // segment b
digitalWrite(4, bitRead(value, 2)); // segment c
digitalWrite(5, bitRead(value, 3)); // segment d
digitalWrite(6, bitRead(value, 4)); // segment e
digitalWrite(7, bitRead(value, 5)); // segment f
digitalWrite(8, bitRead(value, 6)); // segment g
}

void set10(byte value)
{
digitalWrite(9, bitRead(value, 0)); // segment a
digitalWrite(10, bitRead(value, 1)); // segment b
digitalWrite(11, bitRead(value, 2)); // segment c
digitalWrite(12, bitRead(value, 3)); // segment d
digitalWrite(13, bitRead(value, 4)); // segment e
digitalWrite(14, bitRead(value, 5)); // segment f
digitalWrite(15, bitRead(value, 6)); // segment g
}

byte dec27(byte decimal) {
if (decimal == 0)
return B00111111;
if (decimal == 1)
return B00000110;
if (decimal == 2)
return B01011011;
if (decimal == 3)
return B01001111;
if (decimal == 4)
return B01100110;
if (decimal == 5)
return B01101101;
if (decimal == 6)
return B01111101;
if (decimal == 7)
return B0000111;
if (decimal == 8)
return B01111111;
if (decimal == 9)
return B01101111;

return 0;
}

void gameOver()
{
displayNumber(0);
digitalWrite(buzzerPin, HIGH);
delay(3000);
digitalWrite(buzzerPin, LOW);
while (true)
{ ; }
}

Cookies erleichtern die Bereitstellung unserer Dienste. Mit der Nutzung unserer Dienste erklären Sie sich damit einverstanden, dass wir Cookies verwenden.
Weitere Informationen