// Arduino Button Library
// https://github.com/JChristensen/JC_Button
// Copyright (C) 2018 by Jack Christensen and licensed under
// GNU GPL v3.0, https://www.gnu.org/licenses/gpl.html
//
// Example sketch to turn an LED on and off with a tactile button switch.
// Wire the switch from the Arduino pin to ground.
#include <JC_Button.h> // https://github.com/JChristensen/JC_Button
#include "PMButton.h"
//#include "PMButton.h"
//define a pin for a button
PMButton button1(2);
//static bool pinstate;
void setup() {
pinMode(4, OUTPUT);
button1.begin(); }
void loop() {
static bool pinstate;
button1.checkSwitch();
if(button1.clicked()){
pinstate = !pinstate;
digitalWrite(4, pinstate);
}
}