Posted on

Servo Motors

Servo Motors

Setup your breadboard and Arduino using the image below:

Servo Motor Image

Once your image is setup, use the code below to control the Servo

Servo Motor Code

Stuck on Servo Motor? Try this site here: Servo Motor Tutorial

Servo Questions
1 What real-world things use a Servo Motor? Come-up with 3 examples.

2 What could you create with a Servo Motor? How about two Servo Motors?

Servo Challenges:
1 Try to make the Servo Motor go 300 degrees.

2 Try to make the Servo Motor go 90 degrees

3 Try to make the Servo Motor go x degrees (your choice)

4 What happens if you make the Servo Motor go 460 degrees?
HINT: You may need to delete a For() function.

5 Ask for another Servo Motor and try to get two Servo Motors to work at the sametime. What would you need to add? What would your code look like?

6 As a challenge try adding a Potentiometer Knob here to control the location of the Servo Motor. Use the link below.

Potentiometer Knob and Servo Motor

Posted on

Intro to Arrays

Use your Array notes in class to complete the following exercises

//Musical Notes
#define NOTE_B0 31
#define NOTE_C1 33
#define NOTE_CS1 35
#define NOTE_A3 45
#define NOTE_G3 67
#define NOTE_B3 1100
#define NOTE_C4 467

// Melody
int melody[] = {
};

1. What does the number next to each of the notes above mean?
2. Follow the model above and write a new note.
3. Examine the code above and explain what you would need to do in order to play three notes.
4. Look at the above code and write the code needed to place the melody into a loop

Posted on

Arduino Piezo Buzzer Project

Arduino Piezo Buzzer Project

You will need 4 wires and a Piezo buzzer.

Connect the wires as shown to complete a circuit with the Piezo buzzer.

Peiz Arduino Setup

The negative wire should go to the digital ground pin while the positive wire should go to digital pin number 8 and positive should be in ground. If that does not work, place the positive wire in the 5v power pin.
Peizo Digital Pins

To code the Piezo buzzer you will need to create a tab or file that your main Arduino code can access. You should call this new tab pitches.h

To create a new tab click on the arrow located all the way to the right and select New Tab.

New Arduino Tab

Name this tab pitches.h and insert the new code. Use the code located here to cut and paste into a pitches.h tab

Arduino Notes

Then select the your original sketch (also known as your code) and insert the following code by cutting and pasting it.

Melody for Arduino 

Code Challenges:

  1. Figure out how to place the melody on a loop
  2. Figure out how to change the melody notes
  3. Figure out how to change the kind of notes
  4. Figure out how to adjust the delay between each note.
  5. Can you play a recognizable tune? (Note: delete everything in your pitches.h file and insert all the following code into the Arduino Main sketch). You do not need any resistors and make sure your positive wire is in pin 13 and your negative wire is in pin 3.


The Code for a Recognizable Tune

Posted on

Arduino Functions

Directions:
Visit the following web address and complete the questions. You just need the answers.

A. Arduino DigitalWrite Function
1. What is the name of the function?
2. What does it describe (ie: What does it do?)
3. How do you write it (ie: What is it’s Syntax?)
4. What is it’s parameters (ie: What information can you put inside of it?)
5. When would you use the function?
6. Create an example digitalwrite function

B. Arduino AnalogWrite Function
1. What is the name of the function?
2. What does it describe (ie: What does it do? HINT: Read the first two sentences)
3. How do you write it (ie: What is it’s Syntax?)
4. What is it’s parameters (ie: What information can you put inside of it?)
5. When would you use the function?
6. Create an example analogwrite function.

C. Arduino PinMode Function
1. What is the name of the function?
2. What does it describe (ie: What does it do?)
3. How do you write it (ie: What is it’s Syntax?)
4. What is it’s parameters (ie: What information can you put inside of it?)
5. When would you use the function?
6. Create an example pinMode function.

D. Arduino digitalRead Function
1. What is the name of the function?
2. What does it describe (ie: What does it do?)
3. How do you write it (ie: What is it’s Syntax?)
4. What is it’s parameters (ie: What information can you put inside of it?)
5. When would you use the function?
6. Create an example digitalRead function.

Posted on

Arduino Quiz

                  Use the word-bank to match the term to the correct description

LED Transistor DC Motor Servo Motor Resistor

1___________used to restrict electrical current

2__________type of motor that angles

3__________amplifies or boosts electrical power

4__________a type of light that takes 1.5 volts of power

5__________type of motor that spins

Examine the Arduino Board and match the number with the Arduino component. Use the word bank to help. Note: You will NOT use all the words in the word bank

Digital Pins Power Pins Voltage Regulator Reset Button

Arduino Picture

6_________________________(answer for number 1 in picture)

7_________________________(answer for number 2 in picture)

Arduino and Breadboard Practical Exercise: Look at the Arduino and Breadboard and answer the following questions. Note: The lack of power in the Arduino board does not constitute a correct answer.

Picture 1: Close-up

Arduino Problem Picture


Picture 2: Far away
Arduino Problem Setup 2

8 Identify one problem of this Breadboard set-up. Be specific as possible:

9 Identify another problem of this Breadboard set-up. Be specific as possible:

10 Explain what you would need to do to correct this Breadboard set-up. Be specific as possible.