// Each single short press toggles the red LED
// Each single long press toggles the red LED

#include <Toggle.h>

// Variables that remain constant
const byte pinSwitch = 8;
const byte pinLED1 = 3;
const byte pinLED2 = 6;

// Variables that can change
byte LED1state = LOW;
byte LED2state = LOW;
byte code = 0;

Toggle sw(pinSwitch);

void setup () {
  sw.begin(pinSwitch);
  pinMode(pinLED1, OUTPUT);
  pinMode(pinLED2, OUTPUT);
}

void loop () {
  sw.poll();
  code = sw.pressCode();
  if (code == 0xF1) {  // one (F)ast or short press
    LED1state = !LED1state;
    digitalWrite(pinLED1, LED1state);
  }
  else if (code == 0x10) {  // one long press
    LED2state = !LED2state;
  digitalWrite(pinLED2, LED2state);
  }
}