Skip to content

Instantly share code, notes, and snippets.

//Title: Button Debouncing using a State Machine
//Author: Chris Guichet
//Date: Jan 15, 2018
//
//Description:
// -A State Machine is a useful tool to organize complex code
// -Think of it like the next step beyone "If Else" statements
// -This example code uses a State Machine to handle tac switch debouncing
// -It also has a "Hold" function to enable interaction with long button presses
// -The tac switch is used to control a buzzer and an LED, it can multitask
//Title: Button Debouncing using a State Machine, Complex Version
//Author: Chris Guichet
//Date: Jan 15, 2018
//
//Description:
// -A State Machine is a useful tool to organize complex code
// -Think of it like the next step beyone "If Else" statements
// -This example code uses a State Machine to handle tac switch debouncing
// -It also has a "Hold" function to enable interaction with long button presses
//
@NormalUniverse
NormalUniverse / gist:f8dbc04164ce240c973e739a1fb37eeb
Created March 14, 2018 09:28
Simple Button Debounce State Machine
//Title: Button Debouncing using a State Machine, Complex Version
//Author: Chris Guichet
//Date: Jan 15, 2018
//
//Description:
// -A State Machine is a useful tool to organize complex code
// -Think of it like the next step beyone "If Else" statements
// -This example code uses a State Machine to handle tac switch debouncing
// -It also has a "Hold" function to enable interaction with long button presses
//
//***VARIABLES AND SUCH***
#include <Time.h>
#include <TimeLib.h>
#include <Adafruit_NeoPixel.h>
//Variables associated with Clock FSM
int t_hour = 20;
int t_minute = 29;
int t_second = 50;
@NormalUniverse
NormalUniverse / SC_Sandbox_Switch-Class
Created June 25, 2016 21:13
Arduino sketch that creates a "Swith" class that handles debouncing
//***************************************************************************************************
//Defeinition of "Switch" class
//Should I change the name to avoid conflict with "switch" logical structure?
//***************************************************************************************************
//The switch
class Switch
{
public: