 {
     while (true)
     {
-        const unsigned current = sCurrentStep;
+        const unsigned previous = sCurrentStep;
         sCurrentStep = (sCurrentStep + 1) & 0x7;
-        digitalWrite(sPins[current],        LOW);
-        digitalWrite(sPins[sCurrentStep],   HIGH);
+        updatePins(previous);
         if (yield(1000))
         {
             reset();

{
    while (true)
    {
        const unsigned current = sCurrentStep;
        sIncrButton.update();
        sDecrButton.update();

        if (sIncrButton.fallingEdge())
        {
            sCurrentStep = (sCurrentStep + 1) & 0x7;
            digitalWrite(sPins[current],        LOW);
            digitalWrite(sPins[sCurrentStep],   HIGH);
        }
        else if (sDecrButton.fallingEdge())
        {
            sCurrentStep = (sCurrentStep - 1) & 0x7;
            digitalWrite(sPins[current],        LOW);
            digitalWrite(sPins[sCurrentStep],   HIGH);
        }

        if (yield(0))

{
    for (byte i = 0; i < 8; ++i)
    {
        digitalWrite(sOutputPins[i], LOW);
    }
}

void updatePins(byte inPrevious)
{
    digitalWrite(sOutputPins[inPrevious],   LOW);
    digitalWrite(sOutputPins[sCurrentStep], HIGH);
    Serial.print("Pin ");
    Serial.println(sCurrentStep + 1);
}

// -----------------------------------------------------------------------------
