CPE 421 Advance Logic Circuits

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 9

UNIVERSITY OF BOHOL

COLLEGE OF ENGINEERING AND TECHNOLOGY

MA. CLARA STREET TAGBILARAN CITY, BOHOL, PHILIPPINES

CPE 421

ADVANCE LOGIC CIRCUITS

SUMO-ROBOT

SUBMITTED BY:

LEALAINE R. PEREJAN

SUBMITTED TO:

ENGR. VICTOR JOHN ANUNCIADO


INTRODUCTION:

Robot-sumo, or pepe-sumo, is a sport in which two robots attempt to


push each other out of a circle (in a similar fashion to the sport of sumo). The robots
used in this competition are called sumobots. The engineering challenges are for the
robot to find its opponent (usually accomplished with infrared or ultra-sonic sensors) and
to push it out of the flat arena. A robot should also avoid leaving the arena, usually by
means of a sensor that detects the edge.
The most common "weapon" used in a sumobot competition is an angled blade at the
front of the robot, usually tilted at about a 45-degree angle towards the back of the
robot. This blade has an adjustable height for different tactics.

Materials:

Alluminum for body work


2560 Arduino Mega
Motor driver
HC-05 Bluetooth Module
Powerbank
Wires
DC Motor and Gears

Tools:

Screwdriver.
Pliers.
Glue gun.
Scissors for metal.
Saw
Hinges
Bolts
Cable Tie
Drill
Code:

char t;

int Speed = 255;

int Speedsec = 128;

int s = 0;

void setup() {

pinMode(13,OUTPUT); //left motors forward

pinMode(12,OUTPUT); //left motors reverse

pinMode(11,OUTPUT); //right motors forward

pinMode(10,OUTPUT); //right motors reverse

pinMode(5, OUTPUT);

pinMode(6, OUTPUT);

Serial.begin(9600);

void loop() {

if(Serial.available()){

t = Serial.read();

Serial.println(t);

}
if(t == '4'){ //move forward(all motors rotate in forward direction)

analogWrite(11, Speed);

analogWrite(5, Speed);

digitalWrite(13,HIGH);

delay(0);

// digitalWrite(12,LOW);

// digitalWrite(11,HIGH);

// digitalWrite(10,LOW);

else if(t == '1'){ //move reverse (all motors rotate in reverse direction)

analogWrite(10, Speed);

analogWrite(6, Speed);

// digitalWrite(13,LOW);

digitalWrite(12,HIGH);

// digitalWrite(11,LOW);

// digitalWrite(10,HIGH);

else if(t == '2'){ //turn right (left side motors rotate in forward direction, right side
motors doesn't rotate)

analogWrite(11, Speed);

analogWrite(6, Speed);
digitalWrite(13,LOW);

digitalWrite(12,HIGH);

//digitalWrite(11,HIGH); // LOW NI

digitalWrite(10,LOW);

// digitalWrite(13, HIGH);

// digitalWrite(12, LOW);

// delay(100);

// digitalWrite(13,LOW);

// digitalWrite(12,HIGH);

// delay(100);

// digitalWrite(11,HIGH); // LOW NI

// digitalWrite(10,LOW);

else if(t == '3'){ //turn left (right side motors rotate in forward direction, left side
motors doesn't rotate)

analogWrite(10, Speed);

analogWrite(5, Speed);

digitalWrite(13,HIGH); //LOW

digitalWrite(12,LOW);

digitalWrite(11,LOW);
// digitalWrite(10,HIGH);

// digitalWrite(13,HIGH); //LOW

// digitalWrite(12,LOW);

// delay(100);

// digitalWrite(13, LOW);

// digitalWrite(12, HIGH);

// delay(100);

// digitalWrite(11,LOW);

// digitalWrite(10,HIGH);

else if(t == '5'){ //STOP (all motors stop)

analogWrite(11, s);

analogWrite(10, s);

analogWrite(5, s);

analogWrite(6, s);

digitalWrite(13,LOW);

digitalWrite(12,LOW);

// digitalWrite(11,LOW);

// digitalWrite(10,LOW);
}

else if(t == '6') { //turn forward left

analogWrite(11, Speedsec);

analogWrite(5, Speed);

else if (t == '7') { //turn forward right

analogWrite(11, Speed);

analogWrite(5, Speedsec);

else if(t == '8') {

digitalWrite(13, HIGH);

digitalWrite(12, LOW);

else if(t == '5') {

digitalWrite(13, LOW);

digitalWrite(12, LOW);

else if(t == 'b') {

digitalWrite(13, LOW);

digitalWrite(12,HIGH);

else if(t == 'a'){

digitalWrite(13, HIGH);
digitalWrite(12, LOW);

delay(500);

digitalWrite(13, LOW);

digitalWrite(12, HIGH);

delay(500);

Picture:

You might also like