Component: Image Reference:
Transistor P2N2222AG
a1 a3a2
Jumper Wire
Jumper Wire
Pin 9
j2
Jumper Wire
Jumper Wire
Jumper Wire
5V
Jumper Wire
GND
Diode 1N4148
a3
GND
b7 b11
e7 e11
e7 e 11
DC Motor
5V
330Ω Resistor
g2e2
e1
a7 +
+
e3 d11
At this point you're probably starting to get your own ideas for circuits that do fun
things, or help solve a real problem. Excellent! Here are some tips on programming in
general.
Most of the sketches you write will be a loop with some or all of these steps:
1. Perform some sort of input
2. Make some calculations or decisions
3. Perform some sort of output
4. Repeat! (Or not!)
We've already shown you how to use a bunch of dierent input sensors and output
devices (and we still have a few more to go). Feel free to make use of the examples in
your own sketches - this is the whole idea behind the "Open Source" movement.
It's usually pretty easy to pull pieces of dierent sketches together, just open them in
two windows, and copy and paste between them. is is one of the reasons we've
been promoting "good programming habits". ings like using constants for pin
numbers, and breaking your sketch into functions, make it much easier to re-use your
code in new sketches. For example, if you pull in two pieces of code that use the same
pin, you can easily change one of the constants to a new pin. (Don't forget that not
all of the pins support analogWrite(); the compatible pins are marked on your board.)
If you need help, there are internet forums where you can ask questions. Try
Arduino's forum at arduino.cc/forum, and SparkFun's at forum.sparkfun.com.
When you're ready to move to more advanced topics, take a look at Arduino's
tutorials page at arduino.cc/en/tutorial. Many of SparkFun's more advanced
products were programmed with Arduino, (allowing you to easily modify them), or
have Arduino examples for them. See our product pages for info.
Finally, when you create something really cool, consider sharing it with the world so
that others can learn from your genius. Be sure to let us know on
https://www.sparkfun.com/project_calls so we can put it on our home page!
Putting it all together:
P2N2
222A
COLLECTOR
BASE
EMITTER
E B C
Page 67