Gene Lu

Lab Analog Output
Wednesday, 14 October 2009

Servo and Sensor
For this part of the lab, we operate a servo motor using a potentiometer. One notable function used in the code is the map() function. For 'val', we map the values of the potentiometer to the values of the full cycle of a servo motor, meaning that 0 to 1023 is mapped to 0 to 179.  

Speaker Setup
Since the local Radio Shack was out of speakers, I purchased a headphone jack (part no. 274-274) and wired a positive and a negative wire to the end tabs on the jack. Note: The tabs are not polarized, which means that the wires can be connected to either side as long as they are not wired to the same tab.

Headphone jack with the back casing removed
Headphone jack with the back casing removed

Rock Out
After connecting the headphone jack to the breadboard, I 'rocked out' to some headache-inducing noises. Initially, the volume was too loud. By using a larger resistor, we can reduce the volume.

With headphones plugged in, I make myself nauseous with sounds
With headphones plugged in, I make myself nauseous with sounds

Create Something Unique
For this experiment, I connected two potentiometers and a momentary switch to create 'music', aka Robotrance. One potentiometer operated the beat while the other created sounds in the foreground. Note: When using smaller speakers, we can turn up the volume by doing the opposite of what we did in the "Rock Out" section above, by placing smaller resistors in series with the speakers.

Post a Note
Name:
Website:
Title:
 
Security Image

Copyright (C) 2007 Alain Georgette / Copyright (C) 2006 Frantisek Hliva. All rights reserved.

 
Lab Programming 2 < Prev Post   Next Post > Lab Programming w/ Processing