Last active
November 16, 2017 12:39
-
-
Save Krimsit/b00f25374599bc25faff5d52fe73d3c4 to your computer and use it in GitHub Desktop.
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 buz = require('@amperka/buzzer').connect(P5); | |
var button = require('@amperka/button').connect(P8); | |
var pot = require("@amperka/pot").connect(A0); | |
var ir = require("@amperka/ir-receiver").connect(P0); | |
function ReadVal(){ | |
var val = pot.read(); | |
var val1 = Math.floor(val * 10000); | |
console.log(val1); | |
buz.frequency(val1); | |
} | |
button.on("press", function(){ | |
setInterval(ReadVal, 10); | |
buz.turnOn(); | |
console.log('press'); | |
}); | |
button.on("release", function(){ | |
buz.turnOff(); | |
console.log('release'); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment