Introduction: How to Use an Arduino

Hello! Today, I will talk to you about what an Arduino is and how to program it. You will need a few things that are listed on the next step.

Step 1: Parts

For the first project, you will need:

  • Arduino Uno
  • Arduino IDE
  • USB Cable
  • LED

For the second project, you will need:

  • Arduino Uno
  • Arduino IDE
  • USB Cable

Step 2: What Is an Arduino?

An Arduino is a kind of computer called a microcontroller. Microcontrollers are used for all kinds of things such as controlling motors, LEDs, and Speakers. The Arduino Uno use an ATmega328p chip as its central processor and has 32kb of flash memory. If you would like to know more specs, go to arduino.cc.

Step 3: Project 1: Blink

  1. Open the Arduino IDE and create a new sketch.
  2. Click on the Open tab and find examples. Find the blink sketch and open it. Upload it to your board.
  3. If you'd like, you can add an external LED to the board, by inserting the positive lead of the LED into digital pin 13 and inserting the negative lead into the ground pin.

Once you have uploaded the program, the orange LED will start blinking. If you inserted the extra LED, it will start blinking too.

Read the code notes until you understand what each command does. Once you have done that, try making small modifications to the code until you can use these commands and have them committed to memory.

Step 4: Project #2-Servo Control

For the second project, you will learn how to control a servo. The code for this project is fairly simple, but it is still more complicated than the "Blink" sketch. I pasted it below with the code notes.

#include Servo myservo; // create servo object to control a servo

int pos = 0; // variable to store the servo position

void setup() { myservo.attach(9); // attaches the servo on pin 9 to the servo object

}

void loop() {

for (pos = 0; pos <= 180; pos += 1) { // goes from 0 degrees to 180 degrees

myservo.write(pos); // tells servo to go to position in variable 'pos'

delay(15); // waits 15ms for the servo to reach the position }

for (pos = 180; pos >= 0; pos -= 1) { // goes from 180 degrees to 0 degrees

myservo.write(pos);

// tell servo to go to position in variable 'pos'

delay(15); // waits 15ms for the servo to reach the position } }

This code can be directly pasted into the IDE and used. As before, pay attention to the code notes and make sure you understand how to use each command. Make small adjustments to the code, like changing the servo pin or changing the initial position of the servo a small amount. There are many possibilities.

Step 5: Finish

You are done with this tutorial! You know have a very basic understanding of Arduino code. Please continue to learn more about it and keep on making!

Comments

author
prips made it! (author)2016-11-29

it was my first experience with aurdino... very nice experience. feeling happy after completing it.

IMG_20161129_235927.jpgIMG_20161130_000049.jpg
author
DerpyCyclops (author)prips2017-01-24

I'm glad you liked my Instuctable!

author
DerpyCyclops (author)prips2016-12-13

Glad to hear it!

author
stratos13pao (author)2016-11-20

i think you need a resistor since arduino pins output 5 volts that will fry any common L.E.D.

author

Thanks!

author
DerpyCyclops (author)2016-11-20

Yeah, a resistor would be useful for an external LED. The LED on the Arduino labeled "L" also blinks when running the sketch.

author
MagicManu (author)2016-11-20

A led without resistance! This is risky for the led.
A servo motor directly on the output of the Arduino! Risky for the Arduino!

About This Instructable

4,553views

100favorites

License:

More by DerpyCyclops:Iron Man Arc ReactorPinhole Eclipse Viewer (State-Themed)3D-Printed Dremel Centrifuge
Add instructable to: