Created
May 20, 2018 17:10
-
-
Save alanho/1013b6672734a989d296f1e515280e42 to your computer and use it in GitHub Desktop.
General Aircon for Puck.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var isOn = true; | |
var commands = { | |
off: [3.3,1.6,0.4,0.4,0.4,0.4,0.4,1.2,0.4,0.4,0.4,1.2,0.4,0.4,0.4,0.4,0.4,0.4,0.4,1.2,0.4,1.2,0.4,0.4,0.4,0.4,0.4,0.4,0.4,1.2,0.4,1.2,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,1.2,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,1.2,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,1.2,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4], | |
on: [3.3,1.6,0.4,0.4,0.4,0.4,0.4,1.2,0.4,0.4,0.4,1.2,0.4,0.4,0.4,0.4,0.4,0.4,0.4,1.2,0.4,1.2,0.4,0.4,0.4,0.4,0.4,0.4,0.4,1.2,0.4,1.2,0.4,0.4,0.4,0.4,0.5,0.3,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,1.2,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,1.2,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,1.2,0.4,1.2,0.4,1.2,0.4,1.2,0.4,1.2,0.4,1.2,0.4,0.4,0.4,0.4,0.4,0.4,0.4,1.2,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,1.2,0.4,1.2,0.4,0.4,0.4,0.4,0.4,1.2,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,1.2,0.4,1.2,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,1.2,0.4,1.2,0.4,1.2,0.4,1.2,0.4,0.4,0.4,1.2,0.4,1.2,0.4,0.4,0.4] | |
}; | |
setWatch(function() { | |
if (isOn) { | |
console.log('turning off'); | |
Puck.IR(commands.off); | |
} else { | |
console.log('turning on'); | |
Puck.IR(commands.on); | |
} | |
isOn = !isOn; | |
}, BTN, {edge:"rising", debounce:50, repeat:true}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment