xxxxxxxxxx
22
let left = 0;
function setup() {
createCanvas(400, 400);
}
function draw() {
background(220,100,100);
fill("green");
ellipse(left, 30, 30, 30);
}
function keyPressed() {
if (key == " ") {
// important to have in order to start the serial connection!!
setUpSerial();
}
}
function readSerial(data) {
left = map(data, 0, 1023, 0, 400);
}