LEDs and Resistors |
Circuit Built |
Servos connected. |
The next exercise in the manual is looking using an actual circuit on the breadboard, programmatically making two Light Emitting Diodes (LEDs)flash on and off.
This may seem like fairly basic stuff to some of you, and indeed it is, but thats exactly what I was looking for really. I have lots of theoretical knowledge and oodles of ideas, but actual hands on practical experience with electronics and circuits is pretty thin on the ground for me. If you are reading this after having dug through the archives of the blog to find out where it all started and you find this is a bit humbug for you, feel free to zip ahead. Those of you reading each post as I post it, well, you'll just have to put up with my learning pace.
The manual tells me I will need two red LEDs and two 470 ohm resistors for this test circuit, so digging into the box of bits I recieved, I found the little bag of electronics components and using the excellent instructions within the manual, identified the parts I needed.
Before anyone thinks this manual is similar to a recipe book, which tells you to add ingredients without telling you why, let me put things right.
While I had a fair idea of the concept of resistors and LEDs and so on, the purpose of each of them was never really clear to me. I had no idea that an LED can be compared to a one way valve for electricity, and similarly, I had no clue of what a resistor is used for. Some people might say the clue is in the name and to a point they would be right.
My point is, this manual is doing a fair job of giving me a practical grounding in the basics of electronics, which can only be a good thing.
Back to it.
The good news is, I didn't screw up the circuit. There is no bad news, this seems to be working well so far.
As you can see in the second picture, the LEDs are on, nothing seems to be visibly broken and I'm alive to type this. There were in fact a few different things to do in the exercise, mainly to do with making das blinkenflashen lights. It all worked, so thats good.
Next exercise is connecting the servo motors, which is going to be fun.
Simple enough to connect the servos, just had to change a jumper setting and connect the leads to the correct pins on the BOE. The next activity is centering the servos, as they will have left the factory in a workable but unknown state. Centering the servos puts them back to a known position, so circuits can use them with some precision.
Hmm, just shows what happens when you get cocky, part of centering the servos involves using a screwdriver on a potentiometer within the casing of the servo. I rather foolishly assumed it to be the handy phillips head screw in the middle of the servo horn and spent a few minutes cursing the thing for doing nothing. Still, got them done, no damage done.
Here is the code used to center these particular servos. Whether its the same for all servos I dont know yet. Interesting to find out though.
' P13 for manual centering
' {$STAMP BS2}
' {$PBASIC 2.5}
DEBUG "Program running!"
DO
PULSOUT 13, 750
PAUSE 20
LOOP
So, so far so good. I'll stop for a bit now and when I come back, it looks like we are mostly looking at mathematics and getting comfortable with using PBASIC.
No comments:
Post a Comment