Pcomp & ICM Week5 (Synthesis)

Last Friday, we combined our Pcomp and ICM projects together.

I chose my ICM sketch “rainy day”, in which mouseX controls the curtain – if mouseX moves, the curtain will be closed and the window will be covered. I added a analog switch to replace mouseX, so it works like this:

After a while, my partner Lindsey and I decided to add some funny elements to my little project:

It’s a great experience to combine them!

PComp Week4

I designed a simple system using Force-Sensitive Resistor. I connected the FSR with the length of delay: if I press the FSR, the music will go quicker, or it will go as usual.

Here’s the video of my project:

Firstly, I imported the reference form (pitches.h). I tested for several times and found out the tones I wanted (do, re, me, fa, so, la, si, do), then i arranged them a singing pace.

If the value of analogRead changes, the length of delay will change as well, so the music will go faster.

Here’s my code:

#define speakerPin 9
#define forceSensor A5
#include “pitches.h”

int myNotes[] {523,587,659,698,784,880,988,1047};

void setup() {
// put your setup code here, to run once:
tone(speakerPin, 2000, 5000);


void loop() {
// put your main code here, to run repeatedly:

int forceSensor = analogRead(A5);

for (int i = 0; i<8; i=i+1){
tone(speakerPin, myNotes[i], 500);