Tuesday, October 19, 2010

Day 11: creating a sensor



Today, we had to create a sensor. Our sensor was based on measuring resistance, so it had two clips.

We essentially took a piece of felt, wet it, and clipped one clip of the sensor to the felt. The other clip was movable: we would move it back and forth.

The program converts the resistance into a sound. The higher the resistance (ie, the further apart the clips), the higher the sound. We lowered the pitch of the sound by dividing by 2 (otherwise, the notes were really high).

Then we got a little bored, so we cut the felt in half, and created two instruments (with two sensors). We had to use two stacks though: if they were in the same stack, the instruments would alternate playing sounds. (The sound takes time to play, and the program wouldn't move on.) Each piece of felt had a different instrument. Interestingly, because of the way the sensors plugged in, you can put the clips on either piece of felt, and a resistance would be measured (ie even though the clips weren't on the same piece of felt)

Also, the sound got a little annoying after a while, so we added a line that changed the volume with the slider. That just made it easier to shut off the sound.




Then we decided to play with the programming language a bit more.. We made it into a race! Between the two sprites. The sprites would move to the right based on how high the resistance was.

No comments:

Post a Comment