Loves me or Not – IPC – week6

generated flowers using p5.js

Presentation

I created a p5 sketch that takes in the reading of potentiometer and map it to the value of the sizes of the pedal from 0 to 10. The theme is to mimic the game of plucking flower petals when people are unsure about if the person they have a crush on love or does not love them.

Check my code here.

Process

I created two version of this game. One is for ICM and one is for PComp. The one for ICM plays around with mouse position and loading music. You can see the documentation here.


I want to use the potentiometer for PComp. Therefore, I used the data from potentiometer to control the size of the petals and the number of the petals.

Labs

Procedure involving Arduino, P5.Serial Monitor, and P5.js

I spent a lot of time debugging cuz it shows undefined when I try to print out sensorValue. Also, sometimes it gives out a warning of the “something undefined”. I now concluded the steps of using everything together.

  • Upload Arduino 
  • Close Arduino’s serial monitor 
  • Turn on the p5 Serial Monitor Application – No need to open and connect the board
  • Turn on p5 js

Labs somewhat confusing

The labs are good in a way it walks me through the important steps. However, some of the code lines are confusing. I tried to put the code mentioned on the lab in my sketch, it didn’t work. Then I went to the github and copied everything, it worked. I fear maybe there are some lines neglected on the lab instruction. But I am happy that everything works and I can use potentiometer to control the flow of the sketch.

Why do we learn node.js?

Also, the labs on node.js and creating the host website so that other device can display the sketch is quite helpful. However, I am not sure why we would include node.js if we can just use terminal to write python -m SimpleHTTPServer to create a host for our project. I am quite confused by the meaning of learning node.js.


screenshot of terminal commands

I remember I had troubling doing the lab for node.js and it shows up as below where it gives me a type error that SerialPort is not a constructor. I then searched on Github and typed several commands and then I can use the serial port.

screenshot of terminal commands

Conclusion

It is fun to connect everything we have learned so far together. It feels quite rewarding to create something and control certain parameters using sensors.

Published by Yiting Liu

NYU ITP '21

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Create your website with WordPress.com
Get started
<span>%d</span> bloggers like this: