Interfacing Lab Report 1
Interfacing Lab Report 1
SEMESTER 2 2021/2022
Instructor
LAB REPORT 1
INTRO TO ARDUINO
GROUP 11
Observation
1. In our coding, we used an infinite loop in order to get the desired results, also some
math, there is an accumulation code and a condition if else to be met, the 0.5 sec led
blink 2 times then the 1 sec led will blink and when it blinks 6 times the 3 sec led will
blink.
2. We need to connect the negative and positive pins correctly, the anode (long leg) is
connected to Arduino, the cathode (short leg) is connected to the ground. We need to
connect our port to the computer to power supply the Arduino and
https://drive.google.com/file/d/1Tql3Y6vbHovljwCCuNSC6QtuERaZ
dB2N/view?usp=sharing
CODE :
Serial.begin(9600);
pinMode(led2,OUTPUT);
pinMode(led3,OUTPUT); }
void loop() {
int o=0;
int i=0;
while(i==0){
o++;
digitalWrite(led1,1); //turning on the led every 0.5 sec
if(o%2==0){
digitalWrite(led2,1);//turning on the led every 1 sec }
if(o%6==0){
digitalWrite(led3,1);//turning on the led every 3 sec }
digitalWrite(led2,0);
digitalWrite(led3,0); }
}
Second Activity
observation
https://drive.google.com/file/d/1EvlENPboQkduW8xYCNdk-
tjNk1oTKtgE/view?usp=sharing
CODE
Third Activity
Observation:
https://drive.google.com/file/d/1EvlENPboQkduW8xYCNdk-
tjNk1oTKtgE/view?usp=sharing
Code:
const int analogInPin = A0; // Analog input pin that the potentiometer is attached to const
int analogOutPin = 9; // Analog output pin that the LED is attached to
Serial.begin(9600); }
Serial.print(sensorValue);
Serial.print("\t output = ");
Serial.println(outputValue);
delay(2); }
Fourth Activity
Observation
2. For the potentiometer, the red terminal is connected to the +5V, the white terminal is
connected to the signal, and the black terminal is connected to the ground.
3. potentiometer is used to modify the resistance to rotate the servo according mapping ,
so here we used ohm’s law.
CODE :
Photo of your working setup
CONCLOUSIN
In the end of the session the learning out came was incredible for us, we learn how to use
Arduino and get basic knowledge about the power supply and how to use it and the benefit of
servo motor and the important of design the appropriate circuit and appropriate coding.