tinkaMOD

Use Tinkamo bluetooth devices in the web.
bluetoothConnect your Tinkamo!

Javascript

let tinkamo = new Tinkamo();

HTML

<button onclick="tinkamo.connect()">Connect</button>

Getting Started

View all Tinkamo that have been connected.
tinkamo.getTinkamoList();
Runchevron_right
Name Connected Sensor
Search for Tinkamo with a specific name.
tinkamo.getByName('tinka0');
Runchevron_right
Name Connected Sensor

Events

Listen for when a sensor is connected or disconnected.
let tinka0 = tinkamo.getByName('tinka0')[0];
tinka0.addEventListener('sensor change', function(event) {
    console.log(event.value, event.sensor);
});
Connected Sensor
Listen to all sensor readings.
let tinka0 = tinkamo.getByName('tinka0')[0];
tinka0.addEventListener('reading', function(event) {
    console.log(event.sensor, event.value);
});
Sensor Value
Or, specify a sensor.
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'); }
});

Have Fun!

Turn up the volume and make some sounds with the button and Tone.js.

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(); }
});