Physical Computing – Week #4 and #5

This week we learned about analog outputs, after using the motor freestyle last week, right now we can actually control it using PMW pins on the Arduino board.

↯ The lab assignments this week included using analog input to control a servo motor.

↯ The next lab that I made was the tone output using an Arduino. It took me few moments to realize that I need to download the whole tones library, but after I used the code, and plugged the speaker, it was quite fun to make the melody by myself. You can check it out here.

thumb_IMG_0176_1024

 

This is how the part of the melody code looks like:

#include “pitches.h”

// notes in the melody:
int melody[] = {
NOTE_G4, NOTE_E4, NOTE_C4,0, NOTE_C4, NOTE_D4, NOTE_E4, 0,NOTE_D4, NOTE_C4, NOTE_C4, NOTE_C4,0,NOTE_C4,NOTE_D4, NOTE_E4,0
};

// note durations: 4 = quarter note, 8 = eighth note, etc.:
int noteDurations[] = {
4, 4, 4, 4, 4, 4, 4, 4, 8, 8, 4,4, 4,4,4,4,4
};

void setup() {

}

So I’ve looked into getting the right tones, and played with the 4 and 8 until I got to the point where you might recognize the song…

↯ I’ve teamed with Ella, another 1st year to do together the sensor change detection lab. I was testing it with a photocell instead of the FSR.  In this lab we suppose to detect the peak, count presses, or peaks, it sort of a way to know when is the highest and lowest point of pressure, if you need to use those in our projects.

At first I’ve probably had some wiring problems, because the serial monitor kept showing “button was just pressed” even if I didn’t activated the sensor. After a few round of switching both Arduino and breadboard, I got the results.

↯ I made this week another collaboration with Adi, another 1st year, at the ICM/Arduino synthesis, where we decided to a use simple circle growing example, to be controlled by IR sensor. We started by reading the value that the sensor send out, and than mapped it to grow in the limits that we wanted, we than connected our Arduino port to the ICM which makes the serial connection. The result – Mars planet the grows as you get your hand closer to the IR:
thumb_IMG_3991_1024
thumb_IMG_3992_1024

 

 

 

 

 

 

 

 

Leave a comment.

Your email address will not be published. Required fields are marked *