Professional Documents
Culture Documents
Lab Report
Spring 2020
BEMTS- F-17
Registration 170554
Number
Class BEMTS-6 B
Objective:
Per Lab:
In this lab, I learn about programming and different concept that we can you to make our
programming better. These concepts include,
• Control Diagram
• State Diagram
• States’ Value Tables
• Control Techniques
• Program Flow
Control Diagram: A control block diagram is a pictorial representation of the cause and effect
relationship between the input and output of a physical system. A control block diagram provides
a means to easily identify the functional relationships among the various components of a control
system. It defines the major inputs and output of our system.
State Diagram: A state machine diagram models the behavior of a single object, specifying the
sequence of events that an object goes through during its lifetime in response to events.
States’ Value Tables: It basically tell us about the state diagram, that how our machine works
and what are its justifications.
Control Techniques: Control technique can be single our multiple
In single technique, the advantages are,
• To access only one file
• All data available in one file, easy to search
And the disadvantages are,
• Mix-up
• Difficult to test
• Difficult to remove bugs
• Rough technique-Difficult to implement
Components:
➢ Laptop
➢ MATLAB software with additional Hardware Packages
bool RightSide;
#define LeftIR 47
#define MidIR 45
#define RightIR 43
#define Battery1 A0
#define Battery2 A1
#define Buzzer 25
#define LowBattery1 40
#define LowBattery2 42
float B1 = 0.0;
float B2 = 0.0;
int value = 0;
#include <Servo.h>
int ServoGrip = 6;
Servo ServoGripper;
int ServoCont = 7;
Servo ServoContainer;
void LeftMotorForward()
digitalWrite(2,HIGH);
digitalWrite(3,LOW);
void LeftMotorBackward()
digitalWrite(3,HIGH);
digitalWrite(2,LOW);
void RightMotorForward()
digitalWrite(4,HIGH);
digitalWrite(5,LOW);
void RightMotorBackward()
digitalWrite(5,HIGH);
digitalWrite(4,LOW);
void Stop()
digitalWrite(2,LOW);
digitalWrite(3,LOW);
digitalWrite(4,LOW);
digitalWrite(5,LOW);
Stop();
LeftMotorForward();
RightMotorForward();
void GoBackward()
Stop();
LeftMotorBackward();
RightMotorBackward();
void GoRight()
Stop();
LeftMotorForward();
RightMotorBackward();
void GoLeft()
Stop();
LeftMotorBackward();
RightMotorForward();
void MeasureDistances()
RightDistance = RightSensor.measureDistanceCm();
FrontDistance = FrontSensor.measureDistanceCm();
BackDistance = BackSensor.measureDistanceCm();
void BlackLine()
return true;
void CheckBatteryVolts()
value = analogRead(Battery1);
B1 = vout / (R2/(R1+R2));
if (B1<0.09) {
value = analogRead(Battery2);
B2 = vout / (R2/(R1+R2));
if (B1<0.09) {
void LowBatteryAlert()
digitalWrite(Battery1, HIGH);
digitalWrite(Battery2, HIGH);
void setup() {
Serial.begin(115200); // We initialize serial connection so that we could print values from sensor.
pinMode(LeftIR, OUTPUT);
pinMode(MidIR, OUTPUT);
pinMode(RightIR, OUTPUT);
pinMode(Buzzer, OUTPUT);
pinMode(LowBattery1, OUTPUT);
pinMode(LowBattery2, OUTPUT);
ServoGripper.attach(ServoGrip);
ServoContainer.attach(ServoCont);
Serial.println("I'm Starting!!!");
MeasureDistances();
RightSide = false;
else
RightSide = true;
void loop() {
CheckBatteryVolts();
LowBatteryAlert();
MeasureDistances();
while (RightSide)
GoForward();
MeasureDistances();
GoLeft();
MeasureDistances();
GoRight();
MeasureDistances();
GoForward();
MeasureDistances();
if (BlackLine())
GoLeft();
MeasureDistances();
Conclusions:
So, in this lab, I learn about programming and how to make control diagram and state diagram.
I also understand how to do better coding. And what factors should be considered while doing
the coding.
Performance
/
Results /
Viva /
Critical Analysis
/
Individual / Team
Work
Fulfilment of Assigned
Tasks