PBL Activity 6 (Arduino) .
PBL Activity 6 (Arduino) .
Statement Given:
Task I:
● Different Patterns of LED on- off sequence and duration of on - off time
Task II:
Interfacing and controlling of LEDs using Push switch Button provided on LED board.
Evaluation Criteria:
Team
● Respective codes:-
1st code:
const int buttonPin = 2, Il the number of the pushbutton pin
const int ledPin = 13; I/the number of the LED pin
/l vanables will change:
mt buttonSlate = 0; /I variable for reading the pushbutton status
void setup t
I/ mitia ze the LED pin as an output
pinMode(ledPin, OUTPUT);
Il initialze the pushbutton pin as an input pimMode(buttonPin, INPUT),
void loop0 l
Il read the state of the pushbutton value:
buttonState = digitalRead(buttonPin);
I/ check if the pushbutton is pressed. If it is, the buttonState is HIGH:
if (buttonState = HIGH) (
I/ tum LED on:
digita/Write (ledPin, HIGH).
) else [
// tum LED off.
digita Write (ledPin, LOW),
2nd code:
const int buttonPin = 2, // the number of the pushbutton pin const int ledPin = 13; //
the number of the LED pin
// variables will change: int buttonState = 0; // variable for reading the pushbutton
status
void setup() ( // initialize the LED pin as an output pinMode(ledPin, OUTPUT); //
initialize the pushbutton pin as an input pinMode(buttonPin, INPUT);
void loop() ( // read the state of the pushbutton value: buttonState =
digitalRead(buttonPin);
// check if the pushbutton is pressed. If it is, the buttonState is HIGH: if (buttonState =
HIGH) ( // tum LED on:
digitalWrite(ledPin, HIGH); } else ( // turn LED off. digitalWrite(ledPin, LOW);
)
K J Somaiya College of Engineering
A Constituent College of Somaiya Vidyavihar University
Course: Introduction to Project Based Learning
Observations: Task 1-
Task 2-
Reflections:
Learned the importance of precise timing and logic to achieve desired LED patterns.
Gained understanding of input handling with switches, including debouncing
techniques.
Enhanced confidence in combining digital outputs (LEDs) with digital inputs (push
buttons).
The activity bridged theoretical knowledge with practical implementation, reinforcing
programming and hardware skills.