0% found this document useful (0 votes)
4 views

Activity

The document provides an overview of the components and procedures for a blinking LED project using Arduino and Gizduino boards. It explains the Arduino development environment, including the sketchbook feature for storing programs, and outlines the coding procedures for digital and analog input/output. The document includes sample code for controlling an LED and reading analog signals, emphasizing the accessibility of electronics in multidisciplinary projects.

Uploaded by

itsmebasic18
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

Activity

The document provides an overview of the components and procedures for a blinking LED project using Arduino and Gizduino boards. It explains the Arduino development environment, including the sketchbook feature for storing programs, and outlines the coding procedures for digital and analog input/output. The document includes sample code for controlling an LED and reading analog signals, emphasizing the accessibility of electronics in multidisciplinary projects.

Uploaded by

itsmebasic18
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 18

BLINKING LED

Equipment and Materials


1 pc Gizduino Board
1 pc USB Standard A-B Cable
1 set Connecting Wires
1 set Desktop computer/Laptop computer
1 pc Bread Board
10 pcs Red LED
10 pcs 1 KΩ Resistors
Discussion
Arduino
Arduino is an open-source single-board microcontroller designed to make the process of using
electronics in multidisciplinary projects more accessible. The hardware consists of a simple open
hardware design for the Arduino board with an Atmel AVR processor and on-board I/O support. The
software consists of a standard programming language compiler and the boot loader that runs on the
board.
Arduino can sense the environment by receiving input from a variety of sensors and can affect its
surroundings by controlling lights, motors, and other actuators. The microcontroller on the board is
programmed using the Arduino programming language (similar to C++ with some simplifications and
modifications) and the Arduino development environment. Arduino projects can be standalone or they
can communicate with software running on a computer.

Figure 3.1. An Arduino Board.

Gizduino
Gizduino is based on the popular Arduino board which is the Arduino Diecimilia. It is an open source
computing platform based on a simple input/output (I/O) board and the use of standard programming
language. Gizduino is programmed using the Arduino development environment, which can be
donwloaded free from the Arduino website (http://arduino.cc).
Figure 3.2. Gizduino.

Arduino Integrated Development Environment


The Arduino development environment contains a text editor for writing code, a message area, a text
console, a toolbar with buttons for common functions, and a series of menus (see Figure 1.3). It
connects to the Arduino hardware to upload programs and communicate with them.
Figure 3.3. Arduino Development Environment.

Sketchbook
The Arduino environment includes the concept of a sketchbook: a standard place to store your
programs (or sketches). The sketches in your sketchbook can be opened from the File > Sketchbook
menu or from the Open button on the toolbar. The first time you run the Arduino software, it will
automatically create a directory for your sketchbook. You can view or change the location of the
sketchbook location from with the Preferences dialog.

int ledPin = 13; // LED connected to digital pin 13


The message "LED connected to digital pin 13" is a comment.
//set blink delay to 1000 ms (1 s):
int interval = 1000;
void setup()
{
// initialize digital pin 13 as output.
pinMode(13, OUTPUT);
}
void loop()
{
digitalWrite(13, HIGH); // set the LED on
delay(interval); // wait for a second
digitalWrite(13, LOW); // set the LED off
delay(interval); // wait for a second }
DIGITAL INPUT AND OUTPUT
Procedures:
1. Open Arduino IDE. Encode the sketch below:
void setup()
{
// declare pin 2 to be an input:
pinMode(2, INPUT);
//declare pin 3 to be an output:
pinMode(3, OUTPUT);
}
void loop() {
// read pin 2:
if (digitalRead(2) == 1)
{
// if pin 2 is HIGH, set pin 3 HIGH:
digitalWrite(3, HIGH);
}
else
{
// if pin 2 is LOW, set pin 3 LOW:
digitalWrite(3, LOW);
}
ANALOG INPUT AND OUTPUT

const int pwm = 2 ; //initializing pin 2 as ‘pwm’ variable


void setup()
{
pinMode(pwm,OUTPUT) ; //Set pin 2 as output}
void loop()
{
analogWrite(pwm,25) ; //setting pwm to 25
delay(50) ; //delay of 50 ms
analogWrite(pwm,50) ;
delay(50) ;
analogWrite(pwm,75) ;
delay(50) ;
analogWrite(pwm,100) ;
delay(50) ;
analogWrite(pwm,125) ;
delay(50) ;
analogWrite(pwm,150) ;
delay(50) ;
analogWrite(pwm,175) ;
delay(50) ;
analogWrite(pwm,200) ;
delay(50) ;
analogWrite(pwm,225) ;
delay(50) ;
analogWrite(pwm,250) ;
}
const int pwm = 2 ; //naming pin 2 as ‘pwm’ variable
const int adc = 0 ; //naming pin 0 of analog input side as ‘adc’
void setup()
{
pinMode(pwm,OUTPUT) ; //setting pin 2 as output
}
void loop()
{
int adc = analogRead(0) ; //reading analog voltage and storing it in an integer
adc = map(adc, 0, 1023, 0, 255);

/*
----------map funtion------------the above funtion scales the output of adc, which is 10 bit and gives values
btw 0 to 1023, in values btw 0 to 255 form analogWrite funtion which only receives values btw this
range
*/
analogWrite(pwm,adc) ;
}

You might also like