Skip to main content

1. Blinking LED

Blinking LED:

HI, Axtyax here!

Now that you have gotten your arduino and IDE, you are ready to start exploring the world of arduino!

Things You Will Need

  • Solderless Breadboard (if you dont know what this is, look it up)
  • Wires
  • An arduino
  • The arduino cable to connect it to your computer
  • A computer with the arduino IDE
  •  Im not completely sure, but i think you will need an 820ohm 1/8w resistor
  • (if you know of better specs for the resistor, just comment please)
  • And finally, an LED. 

This is a visual representation of how to wire up your circuit that i made in an application called fritzing, which you should definitely download from this link to create schematics for any of your arduino projects.




Ok so now that you have wired up the arduino and
resistor and LED, lets get started on the code!












This is the code:

-----------------------------------------------------------------------------------------


/*
  Blink
  Turns on an LED on for one second, then off for one second, repeatedly.

  This example code is in the public domain.
 */


// Pin 13 has an LED connected on most Arduino boards.
// give it a name:
int led = 13;

// the setup routine runs once when you press reset:
void setup() {              
  // initialize the digital pin as an output.
  pinMode(led, OUTPUT);    
}

// the loop routine runs over and over again forever:
void loop() {
  digitalWrite(led, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(1000);               // wait for a second
  digitalWrite(led, LOW);    // turn the LED off by making the voltage LOW
  delay(1000);               // wait for a second
}
-----------------------------------------------------------------------------------------------------------
So save and upload it to the arduino, and the LED should be blinking!!!
If it doesn't work, try with another LED, it may have just burnt out.

Thanks for reading!

Don't forget to tell your friends and such about this blog, we need more followers!


Comments

Popular posts from this blog

Arduino Lesson : Using a DC motor

Hey guys, today we will be using the arduino to control a motor! to wire this just use this drawing I made in fritzing:   Unfortunately, these kinds of motors do not have an adapter that will allow you to connect it to the arduino, so I had to solder two jumper cables on each of those little metal things that come out of the motor and connect one to ground and the other to pin 6. This code will make that motor start spinning: void setup() { pinMode (6, OUTPUT); } void loop() { digitalWrite (6, HIGH); } Now upload this sketch to your arduino and the motor should start spinning. Which direction does it spin? now try swapping the cables, which way does it spin now? With most motors, it should be spinning in the opposite direction! If you have any problems do not forget to comment them! please follow me on this blog, and on twitter @axtyab, and hopefully refer this blog to others that you know!

C++ Lesson : Variables

Just like in algebra, one of the first thing you must know in programming is how variables work. I am sure you understand, but if you don't, a variable is a letter or symbol that can represent any number. In C++, they can also represent things such as words or characters, but we will get into those later. Lets run through the most basic types of variables: int x; X is now an integer so it can be negative or positive, but NOT a decimal. double x; X can now be negative, positive, AND a decimal. char x; X can now be any one character like Y or H. char's are NOT values, so you CANNOT do any sort of mathematical operation with them, like this: char x = 10; char y = 5; x + y = z; z = 15; WRONG!!! but you CAN do this: char y; char x = 'h'; y = x; Now y = "h" because x = "h" and we said y = x; But now we need to understand how to assign values or characters to these variable types! For int: int x; x = 5; OR in...

The IDE

Now that you have bought the arduino board (make sure you bought the arduino UNO) , let's get the IDE! This is a link to download the IDE: http://arduino.cc/en/main/software IDE stands for Integrated Development Enviorment, which is basically a programming suite for you to perform certain tasks easier. So in this case we will be trying to program our arduino! Go look at this tutorial for your first project with the Arduino: http://arduino.cc/en/tutorial/blink Make sure you hit build and run when you have it all set up!