Professional Documents
Culture Documents
Villanueva Kyle Janssen Exp2
Villanueva Kyle Janssen Exp2
Experiment # 2
Submitted By:
Kyle Janssen M. Villanueva
ECE41
Date Submitted:
September 20, 2018
Instructor
I. Introduction
The pins on the Arduino can be configured as either inputs or outputs. The pins is one of
the determinants on how the circuit connected to it will work. The configurations that are
available to the pins of Arduino shall tackled in this experiment. The function and concept of
pull-up and pull-down resistors will also be determined in this experiment.
• Procedure
• Automatic
void setup() {
Serial.begin (9600);
pinMode(8, INPUT_PULLUP);
pinMode(2, OUTPUT);
pinMode(3, OUTPUT);
pinMode(4, OUTPUT);
pinMode(5, OUTPUT);
pinMode(6, OUTPUT);
void loop() {
int a = 0;
int b = 0;
int c = 1000;
int i;
int x;
d:
if (digitalRead(8)) {
digitalWrite(a, LOW);
} else {
e:
if (a == 0) {
a = 2;
}
else {
a++;
Serial.println("ON");
digitalWrite(a, HIGH);
delay(c);
Serial.println("OFF");
digitalWrite(a, LOW);
if (b == 4) {
c = 1000;
a = 0;
goto d;
else {
c = c + 1000;
a = 0;
b++;
goto e;
}
• Manual
void setup() {
Serial.begin(9600);
int a;
a=2;
pinMode(8, INPUT_PULLUP);
pinMode(2,OUTPUT);
pinMode(3,OUTPUT);
pinMode(4,OUTPUT);
pinMode(5,OUTPUT);
pinMode(6,OUTPUT);
int b=0;
void loop() {
if(digitalRead(8)) {
} else {
digitalWrite(b,LOW);
if(b==0) {
b=2;
} else{
b++;
if(b>6) {
b=0; }
delay(500); }
digitalWrite(b,HIGH); }
III. Observation
In this experiment that we conducted, it is observed that the code “INPUT_PULLUP” has
the default value for the input which is HIGH, unless it is changed in the state of LOW
pressing the “push to break” button included in the circuit. The use of digital input is for the
program to determine how will it handle the high and low output of the source code. We tried
to change the INPUT_PULLUP into INPUT_PULLDOWN for us to be able to observe what
will be the difference in the output that it is producing. It is observed that the difference
between the two is that with an INPUT_PULLUP the state will stay ON if the button
provided is not pressed, but will produce a state that is OFF if the button is pressed. While in
INPUT_PULLDOWN, the state will remain OFF if the button provided is not pressed, but
will produce an ON state if the button is to be pressed.
IV. Conclusion
This experiment shows the importance of how will one decide what digital input shall be
encoded, either INPUT_PULLUP or INPUT_PULLDOWN. Also, this experiment explained
how pullup and pulldown resistors work and how they function inside an Arduino circuit. The
main difference of pull up and pulldown resistor is that the pullup function is originally ON
even if you don’t press any buttons and turns into an OFF state if one pressed the button,
while pull down resistor work in vice versa.