/////////Declare and Initialize Variables////////////////////////////
//The Pin your button is attached to
#define buttonPin 0
#define burninterval 2000
#define delayTime 250

#define A1 4
#define A2 3
#define B1 2
#define B2 1

unsigned long time = 0;          //timecounter for burn interval
unsigned long debounce = 200UL;  //start the clock

// Define the *minimum* length of time, in milli-­‐seconds, that the button must be pressed for a particular option to occur
int op1 = 100;
int op2 = 1000;

//We need to track how long the momentary pushbutton is held for in order to exectute different commands
//This value will be recorded in seconds
int pushbuttonholdtime = 0;


byte fuse = 0b1001;
int reading;


void setup() {
  // Initialize the pushbutton pin as an input pullup
  // Keep in mind, when pin 2 has ground voltage apushbuttonholdtimelied, we know the button is being pressed
  pinMode(buttonPin, INPUT);

  //set the LEDs pins as outputs

  pinMode(A1, OUTPUT);
  pinMode(A2, OUTPUT);
  pinMode(B1, OUTPUT);
  pinMode(B2, OUTPUT);

  digitalWrite(A1, 0);
  digitalWrite(A2, 0);
  digitalWrite(B1, 1);
  digitalWrite(B2, 1);


}  // close setup

void loop() {
  reading = digitalRead(buttonPin);

  // if the input just went from LOW and HIGH and we've waited long enough
  // to ignore any noise on the circuit, toggle the output pin and remember
  // the time
  if (reading == LOW && millis() - time > debounce) {
    burnDiri();
    time = millis();
  }
}
void burnDiri() {

  digitalWrite(A1, bitRead(fuse, 3));
  digitalWrite(A2, bitRead(fuse, 2));
  digitalWrite(B1, bitRead(fuse, 1));
  digitalWrite(B2, bitRead(fuse, 0));
  delay(delayTime);
  digitalWrite(A1, 0);
  digitalWrite(A2, 0);
  digitalWrite(B1, 1);
  digitalWrite(B2, 1);


  if (bitRead(fuse, 0) == 1) {
    fuse += 1;
  } else {
    fuse = ~fuse;
  }
}
ATTINY8520PU