Some of the basic ready to use sample examples of Arduino ide
Answers
Answer:
Hardware Required
Arduino Board
LED
Resistor, anything between 220 ohm to 1K ohm
Circuit
To build the circuit, connect one end of the resistor to Arduino pin 13. Connect the long leg of the LED (the positive leg, called the anode) to the other end of the resistor. Connect the short leg of the LED (the negative leg, called the cathode) to the Arduino GND, as shown in the diagram and the schematic below. Most Arduino boards already have an LED attached to pin 13 on the board itself. If you run this example with no hardware attached, you should see that LED blink. Code
After you build the circuit plug your Arduino board into your computer, start the Arduino IDE, and enter the code below. The first thing you do is to initialize pin 13 as an output pin with the line pin Mode(13, OUTPUT);
In the main loop, you turn the LED on with the line: digital Write(13, HIGH); This supplies 5 volts to pin 13. That creates a voltage difference across the pins of the LED, and lights it up. Then you turn it off with the line: digital Write(13, LOW);
That takes pin 13 back to 0 volts, and turns the LED off. In between the on and the off, you want enough time for a person to see the change, so the delay() commands tell the Arduino to do nothing for 1000 milliseconds, or one second. When you use the delay() command, nothing else happens for that amount of time. Once you've understood the basic examples, check out the Blink Without Delay example to learn how to create a delay while doing other things. Once you've understood this example, check out the Digital Read Serial example to learn how read a switch connected to the Arduino.