Javascript
let tinkamo = new Tinkamo();
HTML
<button onclick="tinkamo.connect()">Connect</button>
Name | Connected | Sensor |
---|
Name | Connected | Sensor |
---|
let tinka0 = tinkamo.getByName('tinka0')[0];
tinka0.addEventListener('sensor change', function(event) {
console.log(event.value, event.sensor);
});
Connected | Sensor |
---|
let tinka0 = tinkamo.getByName('tinka0')[0];
tinka0.addEventListener('reading', function(event) {
console.log(event.sensor, event.value);
});
Sensor | Value |
---|
let tinka0 = tinkamo.getByName('tinka0')[0];
tinka0.addEventListener('button', function(event) {
if (event.value) { console.log('button was pressed down'); }
else { console.log('button was let up'); }
});
let synth = new Tone.Synth().toMaster();
let pitches = ['F3', 'A3', 'A#3', 'C4', 'E4', 'F4', 'A4', 'A#4', 'C5', 'E5', 'F5'];
let tinka0 = tinkamo.getByName('tinka0')[0];
tinka0.addEventListener('button', function(event) {
if (event.value) {
let randomPitch = pitches[randomGenerator.value];
synth.triggerAttack(randomPitch);
}
else { synth.triggerRelease(); }
});