[Advice needed] Building a small BCD clock.

Msquare:
Best way to explain is the code :slight_smile:

The setuploop is called in the loop() code, when we are setting the clock (initiated by a long press of the button, as a short press was used to do something else), ie. it is called repeatedy and often (until the SetClock is false)

Instead of LEDs I have a meter, you just do some visual feedback on your LEDs instead at the SetNeedle()

void setuploop() {

/* This is a small state machine, ensuring we can enter current HH:MI with one button.
  The needle is waved a bit, then wait for number button pushes that sets a single digit. */

static byte Entry = 0 ; // State machine
  static byte N ; static byte H = 0 ; static byte T = 0 ; static byte M = 0 ;

switch (Entry) {
    case 0: case 2: case 4: case 6: wiggle() ; Entry++ ; break ;
    case 1: if (ButtonUpd(&N)) Entry++ ; if (N>2) N=0 ; break ;
    case 3: if (ButtonUpd(&H)) Entry++ ; if (H>9 || (N==2&&H>3)) H=0 ; break ;
    case 5: if (ButtonUpd(&T)) Entry++ ; if (T>5) T=0 ; break ;
    case 7: if (ButtonUpd(&M)) Entry++ ; if (M>9) M=0 ; break ;
    case 8: SetClock = false ;
            //Store a new value in the RTC chip. Date is ignored (random)
            RTC.stopClock();
            RTC.fillByHMS(N10+H,T10+M,0);
            RTC.setTime();
            RTC.startClock();
            break ;
  }
}

boolean ButtonUpd(byte Pdig) {
/
return true when no button change for several seconds. Increment argument for every button push
  put needle at value for feedback. (Wrap is handled by calling function) */

static byte PrvBtn = HIGH ;
  byte Button ;

SetNeedle( *Pdig, 10 ) ;
  if ( millis() - Timer > 5 && (Button=digitalRead(BUTN1)) != PrvBtn) {
    // button change, increment digit if push
    if (Button==LOW) (*Pdig)++ ;
    Timer = millis() ; PrvBtn = Button ;
  }
  return millis() - Timer >5000L ;
}

Nice, may I use it?

Alright guys, I'm back to school and now I have it all set up:
Arduino uno as ISP, trying to program ATtiny2313. All connections are triple checked, the heartbeat led is beating, the cap is between reset and ground. I uploaded the patched ArduinoISP sketch to the arduino, connected the cap and all four wires from the tiny, plus 5 volts and ground. Also connected a resistor and a led to attiny pin 2. Then I tried uploading the sketch to the tiny. No errors, but nothing happens. Tried pins 2 and 6, when it was pin 2 I set it to pin 1 in the sketch. Also tried 2. This is my second processor, since the last one gave the same error every time, so I don't think this one would be broken.

I don't need a bootloader for the tiny when I'm using the arduino as a programmer, right?