Telecommunication

I built off of last week’s assignment by adding a potentiometer to a p5 program. The goal was to use the potentiometer to control the movement of the moon. I had actually wanted to control the movement of the moon in the Y direction, but I wasn’t sure if I’d be able to, so I tried to make sure I could move it along the X axis. Here, I ran into a problem, the moon would not pass 255.

After struggling, I learned that the Serial Port in p5 doesn’t read more than 255, so I would have to map the reading in p5 to the width of my canvas to get a full range of motion. From there I decided to go ahead and use the potentiometer to control the Y movement of the moon, this time only allowing the moon to move from Y 100 to 300, mapping this made the circle’s movement much less sensitive to the turns of the potentiometer. I had also wanted to make it so that when the circle reached a certain altitude, bits of red would creep in from the edges of the canvas. While I got the gradient to be about what I wanted, I had difficulty animating it and abandoned that effort.

The video below shows the program in action. It would be best to watch it on mute.

Find the code on GitHub.

 

Leave a Reply