#include "Arduino.h"
#include "SoftwareSerial.h"
#include <Toggle.h>
// Variables that remain constant
const byte pinSwitch = 8; // My volupPin
const byte pinLED1 = 3; // My pausePin
const byte pinLED2 = 6; // My previousPin
// Variables that can change
byte LED1state = LOW;
byte LED2state = LOW;
byte code = 0;
Toggle sw(pinSwitch);
void setup ()
{
Serial.begin(115200);
Serial.println(F("ToggleLibrary-Toggle_2_LEDs-e1"));
sw.begin(pinSwitch);
pinMode(pinLED1, OUTPUT);
pinMode(pinLED2, OUTPUT);
}
void loop ()
{
sw.poll();
code = sw.pressCode();
if (code == 0xF1)
{
LED1state = !LED1state;
digitalWrite(pinLED1, LED1state);
}
else if (code == 0x10)
{
LED2state = !LED2state;
digitalWrite(pinLED2, LED2state);
}
}