Timer-5-stellig mit 74HC595

Hallo
Ich mache ein Stoppuhr mit Arduino Uno, modifizierte ich ein Schema einer Freundin zu 5 Nummern haben, und ich habe nur eine Taste, um den Start-Funktion, stoppen und neu starten, um in den von Grund auf zu arbeiten, ein Stück Code, aber ich bin sehr stecken, denn ich bin kein guter Programmierstil, wenn mir jemand helfen könnte wäre ich sehr dankbar,
dank

void display(unsigned long numero) {

        int centenas = numero / 10000;
	numero %= 10000;	
        int decenas = numero / 1000;
	numero %= 1000;
	int unidades = numero / 100;
	numero %= 100;
	int decimas = numero / 10;
	numero %= 10;
	int centesimas = numero;

	digitalWrite(LATCH, LOW);
	shiftOut(data, clock, MSBFIRST, digito[centenas]);
	shiftOut(data, clock, MSBFIRST, digito[decenas]);
	shiftOut(data, clock, MSBFIRST, digito[unidades]);
	shiftOut(data, clock, MSBFIRST, digito[decimas]);
	shiftOut(data, clock, MSBFIRST, digito[centesimas]); 
	digitalWrite(LATCH, HIGH);
}

int centenas = numero / 10000;

Ich würde mit einem Array arbeiten. Dann kann man solche Sachen mit weniger Zeilen in eine Schleife machen. Außerdem mit den Einern anfangen

for (int i=0; i<6;i++)
{
Stelle[i]=numero %10;
numero = numero / 10;
}

Mehr kann ich aus dem bißchen Code, den Du uns gibst nicht herauslesen.
Grüße Uwe

Vielen Dank für die Beantwortung
Das Arbeitsgesetz, aber nicht die, die ich brauchen würde, so zu sein
3 Zahlen in Sekunden
1 Anzahl in Zehntel
1 Zahl in Hundertstel
(999.99)
Und mit einer einzigen Taste Start, Stop, Reset Start wieder von 0
laden Sie den Code, so dass Sie helfen können

const int buttonPin = 12;

int value = LOW;                    // previous value of the LED
int buttonState;                    // variable to store button state
int lastButtonState;                // variable to store last button state
int blinking;                       // condition for blinking - timer is timing
long interval = 100;                // blink interval - change to suit
long previousMillis = 0;            // variable to store last time LED was updated
long startTime ;                    // start time for stop watch
long elapsedTime ;                  // elapsed time for stop watch
int fractional;                     // variable used to store fractional part of time


// Definiciones de los 74HC595

int pinLatch	= 4;	//Pin para el latch de los 74CH495
int pinDatos	= 2;	//Pin para Datos serie del 74CH495
int pinReloj	= 3;	//Pin para reloj del 74CH495

byte digitOne[10]= {
	// Codificaci�n hexadecimal de los d�gitos decimales en el display de 7 segmentos
	//0xEE, 0x82, 0xDC, 0xD6, 0xB2, 0x76, 0x7E, 0xC2, 0xFE, 0xF6};
	// Codificacion del autor del Hilo
	
	0xFC, 0x60, 0xDA, 0xF2, 0x66, 0xb6, 0x3E, 0xE0, 0xFE, 0xF6};
	// con esta codificaci�n los leds encienden correctamente
 
 
int  centenas	= 0;	//N�mero de las centenas
int decenas	= 0;    //N�mero de las decenas		= 0;	//Numero de las decimas
int decimas 	= 0;    //Numero de las decimas
int centesimas	= 0;    //numero de las centesimas
void setup(){

	Serial.begin(19200);
	pinMode(pinLatch, OUTPUT);
	pinMode(pinDatos, OUTPUT);
	pinMode(pinReloj, OUTPUT);
	//pinMode(buttonPin, INPUT);
	Serial.println("Cronometro Ok");

	pinMode(ledPin, OUTPUT);         // seteo el pin digital LED como salida

	pinMode(buttonPin, INPUT);       // buttonPin como entrada 
	digitalWrite(buttonPin, HIGH);   // activo el resistor pullup. Cablear el boton de modo que cuando se presione vaya a masa

	}

void loop()
{
	// check for button press
	buttonState = digitalRead(buttonPin);                   // leo el estado del bot�n y lo guardo

	if (buttonState == LOW && lastButtonState == HIGH  &&  blinking == false){     // check for a high to low transition
		// if true then found a new button press while clock is not running - start the clock

		startTime = millis();                                // almacena el tiempo de arranque del cron�metro
		blinking = true;                                     // activar el led durante el cronometrado
		delay(5);                                            // peque�o retardo para evitar rebotes
		lastButtonState = buttonState;                       // guardo buttonState en lastButtonState para luego comparar

	}

	else if (buttonState == LOW && lastButtonState == HIGH && blinking == true){     
			// chequear una transici�n de alto a bajo 
			// si es verdadero luego encontrar una nueva presion del boton mientras el reloj corre - parar el reloj y presentar

			elapsedTime =   millis() - startTime;              // guardo el tiempo transcurrido
			blinking = false;                                  // apago parpadeo
			lastButtonState = buttonState;                     // guardo buttonState en lastButtonState para luego compararlo
			display(elapsedTime );
			// presento el tiempo transcurrido
			Serial.print( (int)(elapsedTime / 1000L));         // divido por 1000 para convertir a segundos luego tomo el entero
		
			Serial.print(".");									// imprimo el punto decimal

			// calculo la parte fraccional
			fractional = (int)(elapsedTime % 1000L);

			// pad in leading zeros - wouldn't it be nice if
			// Arduino language had a flag for this? :)
			if (fractional == 0)
				Serial.print("000");      // add three zero's
			else if (fractional < 10)    // if fractional < 10 the 0 is ignored giving a wrong time, so add the zeros
				Serial.print("00");       // add two zeros
			else if (fractional < 100)
				Serial.print("0");        // add one zero

			Serial.println(fractional);  // print fractional part of time

		}
		else{
			lastButtonState = buttonState;                         // store buttonState in lastButtonState, to compare next time
		}
	if (blinking){ 
		display(millis() - startTime); 
	}

	// Rutina para hacer parpadear un led pin 13 indicando que esta contando.

	if ( (millis() - previousMillis > interval) ) {

		if (blinking == true){
			previousMillis = millis();                         // Recuerndo el momento en que parpadea el led

			// cambio el estado del led
			if (value == LOW)
			value = HIGH;
			else
			value = LOW;
			digitalWrite(ledPin, value);
		}
		else{
			digitalWrite(ledPin, LOW);                         // apago el led cuando no parpadea
		}
	}

}



void display(unsigned long numero) {

        int centenas = numero / 10000;
	numero %= 10000;	
        int decenas = numero / 1000;
	numero %= 1000;
	int unidades = numero / 100;
	numero %= 100;
	int decimas = numero / 10;
	numero %= 10;
	int centesimas = numero;

	digitalWrite(LATCH, LOW);
	shiftOut(data, clock, MSBFIRST, digito[centenas]); 
	shiftOut(data, clock, MSBFIRST, digito[decenas]);
	shiftOut(data, clock, MSBFIRST, digito[unidades]);
	shiftOut(data, clock, MSBFIRST, digito[decimas]);
	shiftOut(data, clock, MSBFIRST, digito[centesimas]);  
	digitalWrite(LATCH, HIGH);
}

Chelas:
Vielen Dank für die Beantwortung
Das Arbeitsgesetz, aber nicht die, die ich brauchen würde, so zu sein
3 Zahlen in Sekunden
1 Anzahl in Zehntel
1 Zahl in Hundertstel
(999.99)
Und mit einer einzigen Taste Start, Stop, Reset Start wieder von 0
laden Sie den Code, so dass Sie helfen können

Your German translator is a mess. I don't understand anything from that "German words". The words are German, but they make no sense for me.

Can you write in English?

What's the problem? May it be, that 'numero' in the display() function is in milliseconds, but you don't want to display milliseconds, but only hundredths of seconds?

Or what's the problem exactly?

In plain English words please, if you cannot write in German.

hi,

Du bist hier willkommen, aber weißt Du, daß es ein spanisches forum gibt?

http://forum.arduino.cc/index.php?board=32.0

gruß stefan

sorry friend
I used google translator and is not very good
What I was trying to explain is that I want to make a timer to mark the numbers in three seconds, one in tenths and one hundredths (999.99) and only have a button that serves to start, stop and start again from scratch
I'm not very good at programming so I wanted to modify this code in which I think has no stop buttons to perform these functions to the diagram change

Thanks and sorry

Hola amigo,

en Español - Arduino Forum encuentras el foro en español con gente muy amable y capacitado ayudarte.

Sé que es casi imposible tratar problemas de programación con un traductor automático.

S alli no saben ayudarte, vuelves y lo intentamos de nuevo. Que te parece?

Hola
Lo intente allí pero no han sido capaces de ayudarme por eso intento que me ayuden aquí por si saben mas
Gracias

entonces mejor que explicas el problema en castellano detallado y lo traduzco.

Y dinos también más o menos el grado de tus conocimientos de programación en Arduino

Te lo agradecería mucho
Lo que quiero hacer es un cronómetro compuesto por 5 dígitos, siendo 3 de ellos para segundos, uno para décimas y otro para centésimas utilizando 74HC595 quedando así 999,99 y que se accione con solo un botón siendo este para iniciar,parar y que volviese a iniciarse desde cero al volver a presionar ,el diagrama que he subido lo he modificado para que sean 5 dígitos y el código le he modificado un poco pero poco del original para que marque 5 números de la forma que he dicho pero creo q no esta bien del todo y habría que modificar el código para el botón, necesito que me echen un ojo al código para modificarlo y para ver como poner lo del botón
Se sobre electrónica pero mi nivel de programación es bajo
Si quieres en otra ocasión te lo escribo por privado por si alguien le sienta mal y si puedes traducir que lo he intentado en el foro español pero no han sabido hacerlo para que no se molesten mejor
Muchas gracias por ayudarme

Also, im spanischen Forum konnten oder wollten sie ihm nicht weiterhelfen.

Er will etwas Hilfe beim abwandeln des Codes, vor allem beim Programmieren des Start/Stop auf einer Taste.

Er will eine Stoppuhr mit 5 Stellen, 3 für Sekunden, je eine für Zehntel und Hundertstel.
Start und Stop soll auf einer Taste liegen, ich nehme an, start > stop > nullstellen > start, ...

Hat sich schon mal jemand seinen Sketch näher angeschaut?