diff options
author | Luke Shumaker <lukeshu@sbcglobal.net> | 2015-02-16 17:40:02 -0500 |
---|---|---|
committer | Luke Shumaker <lukeshu@sbcglobal.net> | 2015-02-16 17:40:02 -0500 |
commit | 74b7077270fdd9d4d7a6eca0bb7011283ae999a8 (patch) | |
tree | 1776cc38d7e64bb980df5436655aeaa37dd27b30 /src/org/usfirst/frc/team4272/robotlib/Toggler.java |
initial commit
Diffstat (limited to 'src/org/usfirst/frc/team4272/robotlib/Toggler.java')
-rw-r--r-- | src/org/usfirst/frc/team4272/robotlib/Toggler.java | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/org/usfirst/frc/team4272/robotlib/Toggler.java b/src/org/usfirst/frc/team4272/robotlib/Toggler.java new file mode 100644 index 0000000..03fffec --- /dev/null +++ b/src/org/usfirst/frc/team4272/robotlib/Toggler.java @@ -0,0 +1,13 @@ +package org.usfirst.frc.team4272.robotlib; + +public class Toggler { + private boolean prev = false; + private boolean state = false; + public boolean update(boolean next) { + if (next && ! prev) { + state = !state; + } + prev = next; + return state; + } +} |