Posted on

## Servo Motors

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

You will need 4 wires and a Piezo buzzer.

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

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.

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.

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

## 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

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

Picture 2: Far away

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.