Skip to content

An abstraction for capturing and reporting on a successful sequence of inputs.

License

Notifications You must be signed in to change notification settings

placer14/Cortex_Button_Sequence

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 

Repository files navigation

Button_Sequence

An abstraction for capturing and reporting on a successful sequence of inputs.

Required Libs

Usage

#include <vector>
#include "Cortex_Debug.h"
#include "Button_Sequence.h"

Button_Sequence<char> sequenceMatcher = Button_Sequence<char>{};
std::vector<char> successSequence = {'3','8','7','2'};

sequenceMatcher.set_solution(successSequence);
sequenceMatcher.add_attempt('3');
sequenceMatcher.add_attempt('8');
sequenceMatcher.add_attempt('7');
if (sequenceMatcher.on_success()) {
  // will not be true
}
sequenceMatcher.add_attempt('2');
if (sequenceMatcher.on_success()) {
  // will only be true once
  success_sound();
}
if (sequenceMatcher.is_successful()) {
  // will always be true while the memory matches the successSequence
  success_sound();
}
sequenceMatcher.reset_memory();

About

An abstraction for capturing and reporting on a successful sequence of inputs.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages