var button = require('@amperka/button') .connect(P3, {holdTime: 0.5}); var buzzer = require('@amperka/buzzer') .connect(P5); var kb = require('@amperka/usb-keyboard'); var random = require('@amperka/hw-random'); var password = ''; function generatePassword() { password = ''; while (password.length < 16) { var code = random.int(33, 126); password += String.fromCharCode(code); } } button.on('hold', function() { generatePassword(); console.log(password); buzzer.beep(0.1); }); button.on('click', function () { kb.type(password); }); generatePassword();