Week 6: Serial Input with Arduino & p5.js

This week I worked with serial input using Arduino and p5.js.  Figure 1 shows the demo from class.  Here are the p5 and Arduino codes that accompany this demo.

Figure 1: Class Demo

Next, I completed the Serial Input to the P5.js IDE Lab (Figure 2). Here are the p5 and Arduino codes that accompany this lab. 

Figure 2: Serial Input Lab

Once I completed the lab, I used serial input to control an existing p5 sketch I made in my ICM class (Figure3&4).  This sketch displays an animation of a snowfall with randomized snowflake patterns.  Using serial input, I adjusted the sparkle of each snowflake based on the location of the potentiometer. Here are the p5 and Arduino codes that accompany the snowfall project. 

Figure 3: Snowfall Controls

Figure 4: Snowfall Animation with Serial Input

Lastly, I completed a new p5 sketch which creates a pattern using rectangles.  Three inputs from the Arduino adjust the pattern.  The button toggles the rectMode between the center and corner modes.  Then one potentiometer adjusts the number of squares that are displayed and the other adjusts the angle between each square. Figure 5 shows the results of this project. Here are the p5 and Arduino codes that accompany the pattern project.

Figure 5: Pattern with Serial Input