Phys Comp – Week 4: Servo Motors && Tone Output

Part I. Working with the Servo motor

I did have some difficulty with setting this up. I think I’ve repressed what went wrong. Anyway, here are photos.

Testing the servo motor
Testing the servo motor
My breadboard set-up for Servo
My breadboard set-up for Servo

Actually it seems that most of my mistakes are caused by plugging in my wires wrong, after I’ve set things up the first time and tried to experiment with something new. I really dislike that it’s something so small and innocuous as putting being off by one set of rows, but I guess that’s how it works. Maybe I should invest in a Polaroid so I can take immediate photos right away. Or, just be faster on the draw with my own camera.

Or, I could create a new sub-culture: breadboard pornography…

Part II. Tone output

I tried a few of the labs and, for my stupid pet trick, ended up modifying the 2nd lab that uses an array to play notes in a specified order and in a specified duration. Both the notes and the duration of the notes can be set in the code. I set up my arduino to play the first 2 bars of ‘Baa Baa Black Sheep’. It doesn’t sound exactly right, but it’s close enough. And, it’s better than the screeching that I was getting with the basic tone output lab.

What you hear when you listen to the link below, is the sound from a speaker that I took from a set of headphones, and buried within the head of my bear. Consequently, it’s pretty quiet.

Baa Baa Black Sheep – music

To play the song, you press a button. I installed my button within the neck of a teddy bear.
The song plays while the button is pressed. When you let go of the button, the music stops. When you press again, the song starts off from where it left off.
When you get to the end of the song, the music starts again at the beginning.

Baa Baa Black Sheep – the code

ICM Week 3: Functions, ‘For Loops’, and ‘If’ statements

This week it got serious. We were using a bunch of Processing methods – if statements, loops and functions – which at the time was a big deal to me, since in practice I still didn’t really understand how to put it all together.

But, I found some residents to help me out and explain how things worked. They also introduced the ‘Switch’ statement, a more efficient ‘if’ statement, which later came in handy for my midterm project. So, while the finished product looks the same as last week, when you check out the code you’ll see that the two sketches are very different.

ICM Week 2

Color bars, Week 3: Switch, Ifs and For Loops

(Written Oct 29, 2009)