My application using serial turned out to be the world’s most boring video game. As a repeated childhood owner of hedgehogs, I’d argue that it’s the cutest… but definitely the most boring.
I’ll admit it didn’t feel that boring to me when I got it to work. Cheap thrills!
I used a ICM sketch, that used classes and functions, commented out the move() function and replaced it with data from the potentiometer. Mathura was instrumental in this process and I’ve since discovered the joys of resident office hours.
I created a function called moveTo() that would read the data (0-255) and map it to the width of the canvas (600). I also created a variable called data_pos and set it to this.x, which is where the hedgehog falls on the x-axis.
I then called that function under serialEvent() by having my “hedgie1.moveTo” and set the parameter to “data”, which read the serial port. The result is a slightly shaky hedgehog which moves when you turn the potentiometer: cute and boring!