Wiring Schematic:
Wiring Instructions:1)Acquire an Arduino
2)Acquire 25 Jumper Cables (not all will be needed), one transistor, five 330 Ohm resistors, one potentiometer, one motor, one RGB LED, one push button, and one diode
Setting Up Power and Ground Columns:
3)Plug a jumper wire into the 5V pin on the Arduino board and the other end of the jumper cable into the top pin in the closet row to the J column marked with a +
4)Plug a jumper into one of the ground pins on the Arduino and the other end into the top pin on the 2nd closet row to the J column marked with a “-“
Setting up the RGB LED:
5)Acquire the RGB and plug the longest lead into pin a5 and having the single lead on its right in pin a4 , then plug a jumper cable into e5 and the other end of it into any pin in the column marked with a plus sign that we used in step 3
6)Using three 330 ohm resistors plug the one end of each into pins e4, e6, and e7
7) Take the other end of the resistor with one end in e4 and place it in g4
8) Take the other end of the resistor with one end in e6 and place it in g6
9) Take the other end of the resistor with one end in e7 and place it in g7
10) Now take a jumper cable and place one end in pin h4 and the other end in pin 3 on the arduino board
11) Now take a jumper cable and place one end in pin h6 and the other end in pin 5 on the arduino board
12) Now take a jumper cable and place one end in pin h7 and the other end in pin 6 on the arduino board
13) Finally place one end of a jumper cable into pin e5 on the bread board and its other end into the column marked with "-" referred to in step 4
Potentiometer:
13) Place the potentiometer on the bread board so its leads are in pins b9, b10, and b11 and has its open face that is marked with three indented columns is facing towards the columns marked with "+" and "-" refereed to in steps 3 and 4
14) Place one jumper cable into e9 and it other end into the any pin not occupied in the column marked with "-" refereed to in step 4
15) Place one jumper cable into pin e10 and its other end into pin A0 on the arduino board
16) Place one jumper cable into pin e11 and its other end into any pin not occupied in the column marked with a "+" referred to in step 3
Push Button:
17) Place the push button so that the leads are in pins d14, d16,g14, and g16
18) Place one jumper cable into pin h16 and its other end into pin 2 on the arduino board
19)Place one 330 ohm resistor into pin i16 and and the end of that any pin not occupied in the column marked with a "+" referred to in step 3
20) Place one jumper cable into pin i14 and its other end into any pin not occupied in the column marked with a "-" referred to in step 4
Motor:
21) Place the motor so that the negative lead is in pin g20 and the positive lead is in pin g22
22) Place the diode so the lead closest to the black stripe on the diode is in pin i22 and the other end in pin i20'
23) Place a jumper cable into pin j22 and the other end into a unused pin othe column marked with a "+" referred to in step 3
24)Place a jumper cable into pin h20 and its other end into pin g26
25)Place a jumper cable into pin g28 and its other end into a unused pin in the column marked with a "-" referred to in step 4
26)Place a 330 ohm resistor into pin g27 and its other end into e27
27)Place a jumper cable into pin a27 and its other end into pin 9 on the arduino board
28)Place a Transistor so the flat side is facing towards the arduino and the pins in j26, j27, and j28
*NOW SIGH THAT ITS FINALLY OVER
Troubleshooting Tips:
-Make sure that all three leads of the RGB LED are inserted into the breadboard correctly.
-Make sure that resistors are used to change the energy going into the RGB
-Make sure a transistor is used with the motor, this is a safety precaution to make sure the motor does
not burn out
-Make sure a diode is used with the motor, this is also a safety precaution to make sure the motor does
not burn out
-If the motor needs a jump-start to run, use lighter resistors so that there is stronger energy getting to
the motor
-Ensure that all leads are inserted at the proper depth to make sure that they are conducting the energy
-Check your code to make sure that all of the pins used on the board correspond to the pins in the code
-Make sure the motor is receiving the energy at the positive end
Code:const int PBNO = 2;
const int Potent = A0;
const int Motor = 9;
const int red = 3;
const int green = 5;
const int blue = 6;
int buttonState = 0;
int potentState = 0;
void setup()
{
pinMode(PBNO,INPUT);
pinMode(Motor,OUTPUT);
pinMode(Potent,INPUT);
pinMode(red,OUTPUT);
pinMode(green,OUTPUT);
pinMode(blue,OUTPUT);
}
void loop()
{
buttonState = digitalRead(PBNO);
potentState = analogRead(Potent);
if (buttonState == HIGH)
{
digitalWrite (Motor, HIGH);
}
else if (buttonState == LOW)
{
digitalWrite(Motor, LOW);
}
{
analogWrite (red, potentState);
analogWrite (green, 0);
analogWrite (blue, 0);
}
}
Source Code:
Credits-
http://www.arduino.cc/en/Tutorial/Pushbutton
http://www.instructables.com/id/RGB-LED-transition-Arduino/
http://www.arduino.cc/en/tutorial/potentiometer
https://learn.adafruit.com/adafruit-arduino-lesson-13-dc-motors/arduino-code
Code Explained-
const int PBNO = 2;
const int Potent = A0;
const int Motor = 9;
const int red = 3;
const int green = 5;
const int blue = 6;
int buttonState = 0;
int potentState = 0;
void setup()
"This section of code is establishing how to refer to an item and creating variables to hold those values. Meaning we can refer to this item on the breadboard with whatever port we declared it to."
{
pinMode(PBNO,INPUT);
pinMode(Motor,OUTPUT);
pinMode(Potent,INPUT);
pinMode(red,OUTPUT);
pinMode(green,OUTPUT);
pinMode(blue,OUTPUT);
}
"This part of the code declares what an item declared in the code is whether is is receiving or sending information to/from the Arduino board."
{
buttonState = digitalRead(PBNO);
potentState = analogRead(Potent);
if (buttonState == HIGH)
{
digitalWrite (Motor, HIGH);
}
else if (buttonState == LOW)
{
digitalWrite(Motor, LOW);
}
2)Acquire 25 Jumper Cables (not all will be needed), one transistor, five 330 Ohm resistors, one potentiometer, one motor, one RGB LED, one push button, and one diode
Setting Up Power and Ground Columns:
3)Plug a jumper wire into the 5V pin on the Arduino board and the other end of the jumper cable into the top pin in the closet row to the J column marked with a +
4)Plug a jumper into one of the ground pins on the Arduino and the other end into the top pin on the 2nd closet row to the J column marked with a “-“
Setting up the RGB LED:
5)Acquire the RGB and plug the longest lead into pin a5 and having the single lead on its right in pin a4 , then plug a jumper cable into e5 and the other end of it into any pin in the column marked with a plus sign that we used in step 3
6)Using three 330 ohm resistors plug the one end of each into pins e4, e6, and e7
7) Take the other end of the resistor with one end in e4 and place it in g4
8) Take the other end of the resistor with one end in e6 and place it in g6
9) Take the other end of the resistor with one end in e7 and place it in g7
10) Now take a jumper cable and place one end in pin h4 and the other end in pin 3 on the arduino board
11) Now take a jumper cable and place one end in pin h6 and the other end in pin 5 on the arduino board
12) Now take a jumper cable and place one end in pin h7 and the other end in pin 6 on the arduino board
13) Finally place one end of a jumper cable into pin e5 on the bread board and its other end into the column marked with "-" referred to in step 4
Potentiometer:
13) Place the potentiometer on the bread board so its leads are in pins b9, b10, and b11 and has its open face that is marked with three indented columns is facing towards the columns marked with "+" and "-" refereed to in steps 3 and 4
14) Place one jumper cable into e9 and it other end into the any pin not occupied in the column marked with "-" refereed to in step 4
15) Place one jumper cable into pin e10 and its other end into pin A0 on the arduino board
16) Place one jumper cable into pin e11 and its other end into any pin not occupied in the column marked with a "+" referred to in step 3
Push Button:
17) Place the push button so that the leads are in pins d14, d16,g14, and g16
18) Place one jumper cable into pin h16 and its other end into pin 2 on the arduino board
19)Place one 330 ohm resistor into pin i16 and and the end of that any pin not occupied in the column marked with a "+" referred to in step 3
20) Place one jumper cable into pin i14 and its other end into any pin not occupied in the column marked with a "-" referred to in step 4
Motor:
21) Place the motor so that the negative lead is in pin g20 and the positive lead is in pin g22
22) Place the diode so the lead closest to the black stripe on the diode is in pin i22 and the other end in pin i20'
23) Place a jumper cable into pin j22 and the other end into a unused pin othe column marked with a "+" referred to in step 3
24)Place a jumper cable into pin h20 and its other end into pin g26
25)Place a jumper cable into pin g28 and its other end into a unused pin in the column marked with a "-" referred to in step 4
26)Place a 330 ohm resistor into pin g27 and its other end into e27
27)Place a jumper cable into pin a27 and its other end into pin 9 on the arduino board
28)Place a Transistor so the flat side is facing towards the arduino and the pins in j26, j27, and j28
*NOW SIGH THAT ITS FINALLY OVER
Troubleshooting Tips:
-Make sure that all three leads of the RGB LED are inserted into the breadboard correctly.
-Make sure that resistors are used to change the energy going into the RGB
-Make sure a transistor is used with the motor, this is a safety precaution to make sure the motor does
not burn out
-Make sure a diode is used with the motor, this is also a safety precaution to make sure the motor does
not burn out
-If the motor needs a jump-start to run, use lighter resistors so that there is stronger energy getting to
the motor
-Ensure that all leads are inserted at the proper depth to make sure that they are conducting the energy
-Check your code to make sure that all of the pins used on the board correspond to the pins in the code
-Make sure the motor is receiving the energy at the positive end
Code:const int PBNO = 2;
const int Potent = A0;
const int Motor = 9;
const int red = 3;
const int green = 5;
const int blue = 6;
int buttonState = 0;
int potentState = 0;
void setup()
{
pinMode(PBNO,INPUT);
pinMode(Motor,OUTPUT);
pinMode(Potent,INPUT);
pinMode(red,OUTPUT);
pinMode(green,OUTPUT);
pinMode(blue,OUTPUT);
}
void loop()
{
buttonState = digitalRead(PBNO);
potentState = analogRead(Potent);
if (buttonState == HIGH)
{
digitalWrite (Motor, HIGH);
}
else if (buttonState == LOW)
{
digitalWrite(Motor, LOW);
}
{
analogWrite (red, potentState);
analogWrite (green, 0);
analogWrite (blue, 0);
}
}
Source Code:
Credits-
http://www.arduino.cc/en/Tutorial/Pushbutton
http://www.instructables.com/id/RGB-LED-transition-Arduino/
http://www.arduino.cc/en/tutorial/potentiometer
https://learn.adafruit.com/adafruit-arduino-lesson-13-dc-motors/arduino-code
Code Explained-
const int PBNO = 2;
const int Potent = A0;
const int Motor = 9;
const int red = 3;
const int green = 5;
const int blue = 6;
int buttonState = 0;
int potentState = 0;
void setup()
"This section of code is establishing how to refer to an item and creating variables to hold those values. Meaning we can refer to this item on the breadboard with whatever port we declared it to."
{
pinMode(PBNO,INPUT);
pinMode(Motor,OUTPUT);
pinMode(Potent,INPUT);
pinMode(red,OUTPUT);
pinMode(green,OUTPUT);
pinMode(blue,OUTPUT);
}
"This part of the code declares what an item declared in the code is whether is is receiving or sending information to/from the Arduino board."
{
buttonState = digitalRead(PBNO);
potentState = analogRead(Potent);
if (buttonState == HIGH)
{
digitalWrite (Motor, HIGH);
}
else if (buttonState == LOW)
{
digitalWrite(Motor, LOW);
}