This building block extends the basic introduction to Transistors: Part 1.
Here we explore controlling many of the motors in your kit using this basic circuit and Digital Output code.
Example circuits include LED, simple DC motor, geared DC motor and solenoid. The solenoid is distinct among these as it requires 9V to turn on.
All of these examples use the same code!
Get The Code
The code used in this video is exactly the same as that used in our introduction to Digital Outputs.
int ledPin = 8 ; // built in
void setup() {
pinMode ( ledPin , OUTPUT) ; // set direction
}
void loop() {
digitalWrite ( ledPin , 1 ) ; // turn LED on
delay ( 1000 ) ; // wait a bit == 1 second
digitalWrite ( ledPin, 0 ) ; // turn LED off
delay ( 1000 ) ; // wait a bit
}
Get the code from tangible on github.
Going Further
Transistors: Part 1 — see the circuit set up.
Contents