K J Somaiya College of Engineering
A Constituent College of Somaiya Vidyavihar University
Course: Introduction to Project Based Learning
Template for Arduino and Multifunction Shield Activity
Statement Given:
Task I:
With codes given to you test following utilities available on multifunction shield
a) Using Beeper on a Multifunction Shield and control the timing and frequency of
beeper using MFS.beep() function which allows us to define
● On time of beep
● Off time of beep
● No of cycles of on-off
● No of loops
● Time delay between loops
b) Control Intensity of LED on Shield using analogWrite Function
c) Writing to Seven Segment Display Digits using MFS.write ()
d) Detecting Push Button Pressed using MFS.getButton()
Task II:
Develop an application for
● Setting time for Microwave ( Use 2 Pushbuttons to set Minutes (0-9) and Seconds in
multiples of 10( 00-50))
● Display set time on seven segment display
● Counting down from predefined time once start is pressed ( Use Third Pushbutton as
Start)
● Beep after time is Lapsed.
Evaluation Criteria:
1. Connections as per task given,
2. Code for Arduino for the Task.
3. Successful execution of the activities.
Performance-15 Marks : Basic tasks = 5 marks , Activity = 10 marks
Submission-10 Marks
Team
Sr No Roll No Name Work Done
1 41 Aryan Lomte
2 42 Shreya Maurya
3 43 Arya Menon
4 44 Neil Mishra
K J Somaiya College of Engineering
A Constituent College of Somaiya Vidyavihar University
Course: Introduction to Project Based Learning
Activity: Using Multifunction Beeper
Code:
#include <Wire.h>
#include <TimerOne.h>
#include <MultiFuncShield.h>
void setup()
{
Timer1.initialize();
MFS.initialize(&Timer1);
MFS.beep();
delay(1000);
MFS.beep(5, 5, 4, 5,50);
}
void loop() {
}
Video of actual implementation:
USING MULTI_FUNCTION BEEP .mp4
Observations and reflections on activity:
Beeper Control:
• Successfully tested different beep durations, cycles, and loop delays using the MFS.beep()
function.
• Observed precise control over the timing and frequency of the beeps.
• Minor delay was noticed when high frequency or long loops were programmed.
K J Somaiya College of Engineering
A Constituent College of Somaiya Vidyavihar University
Course: Introduction to Project Based Learning
Activity: Controlling Leds on Shield
Code:
int testLED = 11; // LED D4 in MF Shield
void setup()
{
// Nothing to do here
}
void loop()
{
for (int fadeValue = 0 ; fadeValue <= 250; fadeValue += 10)
{
analogWrite(testLED, fadeValue);
delay(50);
}
for (int fadeValue = 250 ; fadeValue >= 0; fadeValue -= 10)
{
analogWrite(testLED, fadeValue);
delay(50);
}
}
Video of actual implementation:
CONTROLLING LEDS ON SHIELD .mp4
K J Somaiya College of Engineering
A Constituent College of Somaiya Vidyavihar University
Course: Introduction to Project Based Learning
Observations and reflections on activity:
LED Control:
• Controlled the LEDs on the shield using delays between on and off states.
• LED switching was responsive and aligned with programmed timing.
• Synchronized patterns of multiple LEDs were observed without issues.
Activity: Writing to Seven Segment Display Digits
K J Somaiya College of Engineering
A Constituent College of Somaiya Vidyavihar University
Course: Introduction to Project Based Learning
Code:
#include <TimerOne.h>
#include <Wire.h>
#include <MultiFuncShield.h>
void setup() {
// put your setup code here, to run once:
Timer1.initialize();
MFS.initialize(&Timer1); // initialize multi-function shield library
MFS.write("Hi");
delay(2000);
MFS.write(-273);
delay(2000);
MFS.write(3.141, 2); // display to 2 decimal places.
delay(2000);
}
int counter=0;
byte ended = false;
void loop() {
// put your main code here, to run repeatedly:
if (counter < 20)
{
MFS.write((int)counter);
counter++;
}
else
{
MFS.write("End");
}
delay(100);
}
K J Somaiya College of Engineering
A Constituent College of Somaiya Vidyavihar University
Course: Introduction to Project Based Learning
Video of actual implementation:
WRITING SEVEN SEGMENT TO DISPLAY DIGITS.mp4
Observations and reflections on activity:
Seven-Segment Display:
• Verified proper digit display using the MFS.write() function.
• Displayed single and multi-digit numbers effectively with clear output.
• Errors in input handling required additional validation for unsupported characters
Activity: Detecting Push Button Pressed
Code:
#include <TimerOne.h>
#include <Wire.h>
#include <MultiFuncShield.h>
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
Timer1.initialize();
MFS.initialize(&Timer1); // initialize multi-function shield library
void loop() {
// put your main code here, to run repeatedly:
byte btn = MFS.getButton(); // Normally it is sufficient to compare the return
// value to predefined macros, e.g. BUTTON_1_PRESSED,
// BUTTON_1_LONG_PRESSED etc.
K J Somaiya College of Engineering
A Constituent College of Somaiya Vidyavihar University
Course: Introduction to Project Based Learning
if (btn)
byte buttonNumber = btn & B00111111;
byte buttonAction = btn & B11000000;
Serial.print("BUTTON_");
Serial.write(buttonNumber + '0');
Serial.print("_");
if (buttonAction == BUTTON_PRESSED_IND)
Serial.println("PRESSED");
else if (buttonAction == BUTTON_SHORT_RELEASE_IND)
Serial.println("SHORT_RELEASE");
else if (buttonAction == BUTTON_LONG_PRESSED_IND)
Serial.println("LONG_PRESSED");
else if (buttonAction == BUTTON_LONG_RELEASE_IND)
{
K J Somaiya College of Engineering
A Constituent College of Somaiya Vidyavihar University
Course: Introduction to Project Based Learning
Serial.println("LONG_RELEASE");
Video of actual implementation:
PUSH BUTTON DETECTION .mp4
Observations and reflections on activity:
Push Button Detection:
• MFS.getButton() function reliably detects button presses.
• Tested functionality under rapid pressing scenarios; debounce handling was satisfactory.
• Button feedback was used to dynamically control other shield features.