Last active
November 16, 2017 12:11
-
-
Save Krimsit/02ee9314d591ffca907c1a6a51038de8 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 buz = require('@amperka/buzzer').connect(P5); | |
var led = require('@amperka/led').connect(P2); | |
var button = require('@amperka/button').connect(P8); | |
function getRand(){ | |
return Math.round(Math.random()); | |
} | |
function TO(f, t){ | |
setTimeout(function(){ | |
f(); | |
}, t); | |
} | |
button.on("press", function(){ | |
if(getRand() == 1){ | |
TO(buz.beep(.3), 0.05); | |
TO(led.blink(.3), 0.05); | |
TO(buz.beep(.3), 0.05); | |
TO(led.blink(.3), 0.05); | |
TO(buz.beep(.3), 0.05); | |
TO(led.blink(.3), 0.05); | |
} | |
else{ | |
console.log("LUZER!!!!AZAZA"); | |
} | |
}); | |
console.log(getRand()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment