Alexandra J. Forsythe
Keep in touch!
  • Home
  • About
  • Work
  • Volunteerism

Setting Up and Programming an Arduino

7/18/2016

0 Comments

 
I have been asked how to set up and program an Arduino, and I am going to go through the setup and programming in a few easy steps.

The first step is to install the Arduino IDE, which can be found on Arduino's website. This is where you will write code for the Arduino and upload it to the board. It is, without doubt, one of the most vital components for running an Arduino, second only to the board itself.

Once the IDE is downloaded, the board type must be selected under the "Tools" menu. Simply go to "Board," select whichever board is to be programmed, and move on to plugging the board into your computer. After the board is plugged in and an LED or two has lit up on the board, go to the "Tools" tab again and go to "Port." Select the port that is not "COM 1" or "Serial Ports." If none appear, try "COM 1" and begin uploading the desired code. If it pops up an orange bar at the bottom of the screen which reads "Problem uploading to board," unplug the Arduino and plug it back in while watching the "Port" portion of the "Tools" menu until a different COM port shows up, then select the new COM port. 

Now comes my favorite part: writing the code! Most beginning Adruino users start with the following simple program: 

void setup() {  //The setup which allows the rest of the code to function
  
  pinMode(9, OUTPUT);  //Sets which pin is in use and what mode the pin is in

}  //Ends the setup

void loop() { //Loops everything after the bracket

  digitalWrite(led, HIGH);  //Turns on the LED
  
  delay(1000);  //Sets the amount of time the LED is on in milliseconds
  
  digitalWrite(led, LOW);  //Turns off the LED
  
  delay(1000);  //Sets the amount of time the LED is off      
  
}  //Ends the loop


Once the code has been written, hit the arrow or go to "File" and hit "Upload." 

Building the actual circuit is fairly easy with the most common Arduino, the Arduino Uno: turn off the Adruino by unplugging it, find a 220 Ohm resistor, an LED of any color (as long as it can run off of 5V), and connect the long leg on the LED to the resistor and the short leg to ground. Then wire the non-LED leg of the resistor to whichever Digital pin was chosen, which is shown under pinMode (pin 9 in this example). Power up the Arduino and voila! A blinking LED!
0 Comments



Leave a Reply.

    Author

    Alexandra Forsythe

    Archives

    November 2022
    October 2022
    July 2022
    June 2022
    April 2022
    February 2022
    November 2021
    September 2021
    June 2021
    March 2021
    February 2021
    January 2021
    December 2020
    November 2020
    October 2020
    August 2020
    March 2020
    September 2019
    August 2019
    June 2019
    April 2019
    March 2019
    February 2019
    October 2018
    September 2018
    August 2018
    July 2018
    June 2018
    April 2018
    March 2018
    November 2017
    August 2017
    July 2017
    May 2017
    April 2017
    March 2017
    January 2017
    December 2016
    November 2016
    October 2016
    September 2016
    August 2016
    July 2016
    June 2016
    May 2016
    April 2016
    March 2016
    February 2016
    January 2016
    December 2015

    Categories

    All

    RSS Feed

Powered by Create your own unique website with customizable templates.