Tuesday, December 5, 2006

Circuit 3 - Button + LED

I thought this circuit was pretty neat because it provided us with a certain amount of control. Humans like to control things, and it was pretty satisfying to be able to open and close the circuit to turn my little LED on and off at the click of a button. This simple technique will surely come in handy in this course in the future, especially in any sort of interactive installation where we may want the participants to have control over something. As far as the technicality goes, I didn't seem to have any trouble putting this one together.


Code:

' {$STAMP BS2sx}
' {$PBASIC 2.5}


' control an LED switch a switch
' using an IF..THEN structure


' ****** variables ************

mySwitch VAR BIT ' looking at a switch so only a BIT is required

' ****** setup ********

myLed CON 1 ' connect a digital out to this PIN

' **** processing ************

DO
'read the state of switch
mySwitch = IN0
DEBUG ? mySwitch

' write state of switch to myLED
IF mySwitch = 0 THEN
LOW myLed
ELSE
HIGH myLed
ENDIF

LOOP

Photos:





Video:



Resource: here.

Saturday, December 2, 2006

Circuit 2 - Speaker

Well one thing is for sure, I can't stand the sound that this makes, it drives me absolutely insane, but by playing with the capacitors and resistors I have managed to make it beep rather than let off one long obnoxious screech. It is undoubtedly a joyous moment when the speaker first makes a sound (just as it was when my LED lit up for the first time), but when you have a whole classroom full of screeching speakers... it's not exactly the most pleasant thing in the world! It was cool though, and I found it really interesting how you could do different things to control the sound, hook up a switch to change the pitch, and so on. It will also be interesting to see where we can take this next semester. When building this circuit, I had some minor problems controlling the sound in the beginning, it was pretty unpleasant, but with some help from Norm they were not particularly hard to solve.

Photos:






Video:



Resource: here.