xxxxxxxxxx
function setup() {
createCanvas(windowWidth, windowHeight);
background(220);
}
function mouseClicked() {
P5tCube.connectNewP5tCube().then(cube => {
// Button press event
const typeButton = 'buttonpress';
cube.addEventListener(typeButton, ()=>{
console.log(typeButton);
});
// Posture change event
const typePosture = 'sensorposturechange';
cube.addEventListener(typePosture, (posture)=>{
console.log(typePosture, posture);
});
cube?.turnLightOn( 'white' );
});
}