SlideShare a Scribd company logo
1 of 15
Download to read offline
/ GENESIS BOARD MINI SUMO ROBOT PROGRAM
//FOR 3 OPPONENT SENSOR, 2 EDGE SENSOR
// JSUMO 01/2020
///////////////////////////////////////
//MOTOR CONTROL
int RPwm = 11;
int RDir = 13;
int LPwm = 3;
int LDir = 12;
//LED & BUZZER
int Buzzer = 9;
int ArduLed = 8;
//EDGE & CONTRAST SENSORS
int Redge = A0;
int Ledge = A1;
//TRIMPOTS
int SPD = A7;
int TRN = A6;
//OPPONENT SENSORS
int LSens = A4;
int RSens = A2;
int MSens = A3;
int LFSens = A5;
int RFSens = 4;
// DIPSWITCH & BUTTON
int Button = 10; // Can be used as start pin too.
int DS1 = 5;
int DS2 = 6;
int DS3 = 7;
//VALUES
int Speed =50;
int MaxSpeed = 80; // Idle Speed while no sensor giving data.
int TurnSpeed = 65; // Left and Right Forward Turning Speed
int EdgeTurn = 150; // Turning Time variable when minisumo sees white line
int Duration; // Turning Time at minisumo starting.
int LastValue = 5; // Last Value Variable for remembering last Opponent sensor sense.
void setup()
{
pinMode(LSens, INPUT); // Left Opponent Sensor Input
pinMode(RSens, INPUT); // Right Opponent Sensor Input
pinMode(MSens, INPUT); // Middle Opponent Sensor Input
pinMode(Buzzer, OUTPUT); // Buzzer Declared as Output
pinMode(ArduLed, OUTPUT); // Buzzer Declared as Output
pinMode(Button, INPUT); // Buzzer Declared as Output
pinMode(RPwm, OUTPUT); // Four PWM Channel Declared as Output
pinMode(RDir, OUTPUT);
pinMode(LPwm, OUTPUT);
pinMode(LDir, OUTPUT);
digitalWrite(Buzzer, LOW); // Buzzer Pin Made Low for Silence
digitalWrite(ArduLed, LOW); // Arduino Mode Led Made Low
digitalWrite(DS1, HIGH); // 3 Dipswitch Pin Pullups Made
digitalWrite(DS2, HIGH);
digitalWrite(DS3, HIGH);
digitalWrite(LSens, HIGH); // Opponent Sensor Pullups Made
digitalWrite(RSens, HIGH);
digitalWrite(LFSens, HIGH);
digitalWrite(RFSens, HIGH);
digitalWrite(MSens, HIGH);
Serial.begin(9600);
}
//Motor Control Function
void Set_Motor (float Lval, float Rval, int timex){
Lval = Lval*2.5;
Rval = Rval*2.5;
if (Lval >=0) {
analogWrite(LPwm, Lval);
digitalWrite(LDir, LOW);
} else {
Lval=abs(Lval);
digitalWrite(LDir, HIGH);
analogWrite(LPwm, Lval);
}
if (Rval >=0) {
analogWrite(RPwm, Rval);
digitalWrite(RDir, HIGH);
} else {
Rval=abs(Rval);
digitalWrite(RDir, LOW);
analogWrite(RPwm, Rval);
}
//If you want to see Speed Values please uncomment bottom line.
// Serial.print(Rval); Serial.print(-); Serial.println(Lval);
delay(timex);
}
void loop() {
digitalWrite(RPwm, LOW);
digitalWrite(LPwm, LOW);
tone(Buzzer, 18, 100); // Pin, Frequency, Duration
//////////////////////////////////////////////
// This function below, used for stopping robot while no button is pushed or Microstart is not
triggered.
while (digitalRead(Button)==0) {
Serial.println(Button Press Waited);
Set_Motor(0,0,1);
/// Sensor Control While Waiting The Button Press ///
if ( digitalRead(MSens)==LOW || digitalRead(RSens)==LOW || digitalRead(LSens)== LOW ||
digitalRead(RFSens)==LOW || digitalRead(LFSens)== LOW || analogRead(Redge)< 100 ||
analogRead(Ledge)< 100 ) { digitalWrite(ArduLed, HIGH);}
else { digitalWrite(ArduLed, LOW); }
}
///////////////////////////////////////////////
if (digitalRead(Button)==1) {
Duration=(analogRead(TRN)/5); // Duration variable based on TRN (A6) trimpot
Duration=205-Duration; //
Serial.println(5 Sec Routine Started);
for (int i = 0; i < 5; i++){ digitalWrite(Buzzer, HIGH); digitalWrite(ArduLed, HIGH);
delay(100); digitalWrite(Buzzer, LOW); digitalWrite(ArduLed, LOW); delay(900); }
if (digitalRead(DS1)==0 && digitalRead(DS2)==1 && digitalRead(DS3)==1){
Serial.print(LEFT TURN);
Set_Motor(-100,100,Duration); //
}
else if (digitalRead(DS1)==0 && digitalRead(DS2)==0 && digitalRead(DS3)==0) {
Serial.print(MIDDLE DIRECT);
Set_Motor(80,80,2);
}
else if (digitalRead(DS1)==1 && digitalRead(DS2)==1 && digitalRead(DS3)==0){
Serial.print(Sag);
Set_Motor(100,-100,Duration);
}
else if (digitalRead(DS1)==1 && digitalRead(DS2)==0 && digitalRead(DS3)==0){
Serial.print(Left Circle);
Set_Motor(100,36,650);
}
else if (digitalRead(DS1)==0 && digitalRead(DS2)==0 && digitalRead(DS3)==1){
Serial.print(Right Circle);
Set_Motor(36,100,650);
}
else if (digitalRead(DS1)==0 && digitalRead(DS2)==1 && digitalRead(DS3)==0){
Serial.print(Reverse 180);
Set_Motor(-100,100,Duration*2); // One Duration time is for 90 degree, so we multiply by 2.
}
Serial.print(OK);
digitalWrite(Buzzer, LOW);
EdgeTurn=(analogRead(TRN)/5); // Raw value comes with 0 to 1023, we divide it for 0 t0 205
mS turning time.
EdgeTurn=205-EdgeTurn; //
}
//Main Loop
while(1) {
/// Edge Sensor Control Routine ///
digitalWrite(ArduLed, LOW);
if (analogRead(Ledge)<300 && analogRead(Redge)> 300) {
digitalWrite(Buzzer, LOW);
digitalWrite(ArduLed, HIGH);
Set_Motor(-100, -100,55); // Backward for 55 mS.
Set_Motor(-100, 100, EdgeTurn); // Left Backward, Right Forward, Turning Time Based on
ETRN Trimpot
LastValue=5;
}
else if (analogRead(Ledge)> 300 && analogRead(Redge)< 300) {
digitalWrite(Buzzer, LOW);
digitalWrite(ArduLed, HIGH);
Set_Motor(-100, -100,55); // Backward for 55 mS.
Set_Motor(100, -100, EdgeTurn); // Right Backward, Left Forward, Turning Time Based on
ETRN Trimpot
LastValue=5;
}
else if (analogRead(Ledge)< 300 && analogRead(Redge)< 300) {
digitalWrite(Buzzer, LOW);
digitalWrite(ArduLed, HIGH);
Set_Motor(-100, -100,55); // Backward for 55 mS.
Set_Motor(100, -100, EdgeTurn); // Right Backward, Left Forward, Turning Time Based on
ETRN Trimpot
LastValue=5;
}else
/// Opponent Sensor Control Routine ///
// Please uncomment below line if yu are using microstart, When microstart gives 0V it will stop
motors.
//while (digitalRead(Button)==LOW) {Set_Motor(0, 0, 20); digitalWrite(Buzzer, HIGH);
LastValue=3;} digitalWrite(Buzzer, LOW);
if (digitalRead(MSens)==LOW) {Set_Motor(MaxSpeed, MaxSpeed,1); digitalWrite(Buzzer,
HIGH); LastValue=5;} else
if (digitalRead(LSens)== LOW) {Set_Motor(-40, TurnSpeed,1); digitalWrite(Buzzer, HIGH);
LastValue=7;} else
if (digitalRead(RSens)==LOW) {Set_Motor(TurnSpeed, -40,1); digitalWrite(Buzzer, HIGH);
LastValue=3;} else
if (digitalRead(LFSens)== LOW) {Set_Motor(-40, TurnSpeed,1); digitalWrite(Buzzer, HIGH);
LastValue=7;} else
if (digitalRead(RFSens)==LOW) {Set_Motor(TurnSpeed, -40,1); digitalWrite(Buzzer, HIGH);
LastValue=3;} else
{
digitalWrite(Buzzer, LOW);
Speed=(analogRead(SPD)/10.3); // This raw speed value comes with 0 to 1023 so we divide to
10.3 After that it is 0 to 99 integer.
Speed=100-Speed; // This is used for reversing trimpot dial direction at board.
if (LastValue==5) { Set_Motor(Speed, Speed,1);} else // Forward, Based on SPD (A7) Trimpot
if (LastValue==7) { Set_Motor(-20, Speed,2);} else // Left Turning Based on SPD (A7) Trimpot
if (LastValue==3) { Set_Motor(Speed, -20,2);} // Right Turning Based on SPD (A7) Trimpot
}
}
}
Can you integrate the above code according to the items written below?
Now program your robot to follow a square shaped path, as follows:
i. Go forward for one second,
ii. Make a 90 degree left turn,
iii. Go to step (i).
iv. Stop after four turns.
/ GENESIS BOARD MINI SUMO ROBOT PROGRAM
//FOR 3 OPPONENT SENSOR, 2 EDGE SENSOR
// JSUMO 01/2020
///////////////////////////////////////
//MOTOR CONTROL
int RPwm = 11;
int RDir = 13;
int LPwm = 3;
int LDir = 12;
//LED & BUZZER
int Buzzer = 9;
int ArduLed = 8;
//EDGE & CONTRAST SENSORS
int Redge = A0;
int Ledge = A1;
//TRIMPOTS
int SPD = A7;
int TRN = A6;
//OPPONENT SENSORS
int LSens = A4;
int RSens = A2;
int MSens = A3;
int LFSens = A5;
int RFSens = 4;
// DIPSWITCH & BUTTON
int Button = 10; // Can be used as start pin too.
int DS1 = 5;
int DS2 = 6;
int DS3 = 7;
//VALUES
int Speed =50;
int MaxSpeed = 80; // Idle Speed while no sensor giving data.
int TurnSpeed = 65; // Left and Right Forward Turning Speed
int EdgeTurn = 150; // Turning Time variable when minisumo sees white line
int Duration; // Turning Time at minisumo starting.
int LastValue = 5; // Last Value Variable for remembering last Opponent sensor sense.
void setup()
{
pinMode(LSens, INPUT); // Left Opponent Sensor Input
pinMode(RSens, INPUT); // Right Opponent Sensor Input
pinMode(MSens, INPUT); // Middle Opponent Sensor Input
pinMode(Buzzer, OUTPUT); // Buzzer Declared as Output
pinMode(ArduLed, OUTPUT); // Buzzer Declared as Output
pinMode(Button, INPUT); // Buzzer Declared as Output
pinMode(RPwm, OUTPUT); // Four PWM Channel Declared as Output
pinMode(RDir, OUTPUT);
pinMode(LPwm, OUTPUT);
pinMode(LDir, OUTPUT);
digitalWrite(Buzzer, LOW); // Buzzer Pin Made Low for Silence
digitalWrite(ArduLed, LOW); // Arduino Mode Led Made Low
digitalWrite(DS1, HIGH); // 3 Dipswitch Pin Pullups Made
digitalWrite(DS2, HIGH);
digitalWrite(DS3, HIGH);
digitalWrite(LSens, HIGH); // Opponent Sensor Pullups Made
digitalWrite(RSens, HIGH);
digitalWrite(LFSens, HIGH);
digitalWrite(RFSens, HIGH);
digitalWrite(MSens, HIGH);
Serial.begin(9600);
}
//Motor Control Function
void Set_Motor (float Lval, float Rval, int timex){
Lval = Lval*2.5;
Rval = Rval*2.5;
if (Lval >=0) {
analogWrite(LPwm, Lval);
digitalWrite(LDir, LOW);
} else {
Lval=abs(Lval);
digitalWrite(LDir, HIGH);
analogWrite(LPwm, Lval);
}
if (Rval >=0) {
analogWrite(RPwm, Rval);
digitalWrite(RDir, HIGH);
} else {
Rval=abs(Rval);
digitalWrite(RDir, LOW);
analogWrite(RPwm, Rval);
}
//If you want to see Speed Values please uncomment bottom line.
// Serial.print(Rval); Serial.print(-); Serial.println(Lval);
delay(timex);
}
void loop() {
digitalWrite(RPwm, LOW);
digitalWrite(LPwm, LOW);
tone(Buzzer, 18, 100); // Pin, Frequency, Duration
//////////////////////////////////////////////
// This function below, used for stopping robot while no button is pushed or Microstart is not
triggered.
while (digitalRead(Button)==0) {
Serial.println(Button Press Waited);
Set_Motor(0,0,1);
/// Sensor Control While Waiting The Button Press ///
if ( digitalRead(MSens)==LOW || digitalRead(RSens)==LOW || digitalRead(LSens)== LOW ||
digitalRead(RFSens)==LOW || digitalRead(LFSens)== LOW || analogRead(Redge)< 100 ||
analogRead(Ledge)< 100 ) { digitalWrite(ArduLed, HIGH);}
else { digitalWrite(ArduLed, LOW); }
}
///////////////////////////////////////////////
if (digitalRead(Button)==1) {
Duration=(analogRead(TRN)/5); // Duration variable based on TRN (A6) trimpot
Duration=205-Duration; //
Serial.println(5 Sec Routine Started);
for (int i = 0; i < 5; i++){ digitalWrite(Buzzer, HIGH); digitalWrite(ArduLed, HIGH);
delay(100); digitalWrite(Buzzer, LOW); digitalWrite(ArduLed, LOW); delay(900); }
if (digitalRead(DS1)==0 && digitalRead(DS2)==1 && digitalRead(DS3)==1){
Serial.print(LEFT TURN);
Set_Motor(-100,100,Duration); //
}
else if (digitalRead(DS1)==0 && digitalRead(DS2)==0 && digitalRead(DS3)==0) {
Serial.print(MIDDLE DIRECT);
Set_Motor(80,80,2);
}
else if (digitalRead(DS1)==1 && digitalRead(DS2)==1 && digitalRead(DS3)==0){
Serial.print(Sag);
Set_Motor(100,-100,Duration);
}
else if (digitalRead(DS1)==1 && digitalRead(DS2)==0 && digitalRead(DS3)==0){
Serial.print(Left Circle);
Set_Motor(100,36,650);
}
else if (digitalRead(DS1)==0 && digitalRead(DS2)==0 && digitalRead(DS3)==1){
Serial.print(Right Circle);
Set_Motor(36,100,650);
}
else if (digitalRead(DS1)==0 && digitalRead(DS2)==1 && digitalRead(DS3)==0){
Serial.print(Reverse 180);
Set_Motor(-100,100,Duration*2); // One Duration time is for 90 degree, so we multiply by 2.
}
Serial.print(OK);
digitalWrite(Buzzer, LOW);
EdgeTurn=(analogRead(TRN)/5); // Raw value comes with 0 to 1023, we divide it for 0 t0 205
mS turning time.
EdgeTurn=205-EdgeTurn; //
}
//Main Loop
while(1) {
/// Edge Sensor Control Routine ///
digitalWrite(ArduLed, LOW);
if (analogRead(Ledge)<300 && analogRead(Redge)> 300) {
digitalWrite(Buzzer, LOW);
digitalWrite(ArduLed, HIGH);
Set_Motor(-100, -100,55); // Backward for 55 mS.
Set_Motor(-100, 100, EdgeTurn); // Left Backward, Right Forward, Turning Time Based on
ETRN Trimpot
LastValue=5;
}
else if (analogRead(Ledge)> 300 && analogRead(Redge)< 300) {
digitalWrite(Buzzer, LOW);
digitalWrite(ArduLed, HIGH);
Set_Motor(-100, -100,55); // Backward for 55 mS.
Set_Motor(100, -100, EdgeTurn); // Right Backward, Left Forward, Turning Time Based on
ETRN Trimpot
LastValue=5;
}
else if (analogRead(Ledge)< 300 && analogRead(Redge)< 300) {
digitalWrite(Buzzer, LOW);
digitalWrite(ArduLed, HIGH);
Set_Motor(-100, -100,55); // Backward for 55 mS.
Set_Motor(100, -100, EdgeTurn); // Right Backward, Left Forward, Turning Time Based on
ETRN Trimpot
LastValue=5;
}else
/// Opponent Sensor Control Routine ///
// Please uncomment below line if yu are using microstart, When microstart gives 0V it will stop
motors.
//while (digitalRead(Button)==LOW) {Set_Motor(0, 0, 20); digitalWrite(Buzzer, HIGH);
LastValue=3;} digitalWrite(Buzzer, LOW);
if (digitalRead(MSens)==LOW) {Set_Motor(MaxSpeed, MaxSpeed,1); digitalWrite(Buzzer,
HIGH); LastValue=5;} else
if (digitalRead(LSens)== LOW) {Set_Motor(-40, TurnSpeed,1); digitalWrite(Buzzer, HIGH);
LastValue=7;} else
if (digitalRead(RSens)==LOW) {Set_Motor(TurnSpeed, -40,1); digitalWrite(Buzzer, HIGH);
LastValue=3;} else
if (digitalRead(LFSens)== LOW) {Set_Motor(-40, TurnSpeed,1); digitalWrite(Buzzer, HIGH);
LastValue=7;} else
if (digitalRead(RFSens)==LOW) {Set_Motor(TurnSpeed, -40,1); digitalWrite(Buzzer, HIGH);
LastValue=3;} else
{
digitalWrite(Buzzer, LOW);
Speed=(analogRead(SPD)/10.3); // This raw speed value comes with 0 to 1023 so we divide to
10.3 After that it is 0 to 99 integer.
Speed=100-Speed; // This is used for reversing trimpot dial direction at board.
if (LastValue==5) { Set_Motor(Speed, Speed,1);} else // Forward, Based on SPD (A7) Trimpot
if (LastValue==7) { Set_Motor(-20, Speed,2);} else // Left Turning Based on SPD (A7) Trimpot
if (LastValue==3) { Set_Motor(Speed, -20,2);} // Right Turning Based on SPD (A7) Trimpot
}
}
}
Can you integrate the above code according to the items written below?
Now program your robot to follow a square shaped path, as follows:
i. Go forward for one second,
ii. Make a 90 degree left turn,
iii. Go to step (i).
iv. Stop after four turns.
Now program your robot to follow a square shaped path, as follows:
i. Go forward for one second,
ii. Make a 90 degree left turn,
iii. Go to step (i).
iv. Stop after four turns.

More Related Content

Similar to GENESIS BOARD MINI SUMO ROBOT PROGRAMFOR 3 OPPONENT SENSOR, .pdf

Twin wheeler modified for arduino simplified serial protocol to sabertooth v22
Twin wheeler modified for arduino simplified serial protocol to sabertooth v22Twin wheeler modified for arduino simplified serial protocol to sabertooth v22
Twin wheeler modified for arduino simplified serial protocol to sabertooth v22josnihmurni2907
 
Ldr based line follower robot
Ldr based line follower robotLdr based line follower robot
Ldr based line follower robotAkshay Sharma
 
Scottish Ruby Conference 2010 Arduino, Ruby RAD
Scottish Ruby Conference 2010 Arduino, Ruby RADScottish Ruby Conference 2010 Arduino, Ruby RAD
Scottish Ruby Conference 2010 Arduino, Ruby RADlostcaggy
 
PROGRAMMING ADC and DAC-mbed.pdf
PROGRAMMING ADC and DAC-mbed.pdfPROGRAMMING ADC and DAC-mbed.pdf
PROGRAMMING ADC and DAC-mbed.pdfvidhyalakshmi153619
 
MaxBotix Code Examples
MaxBotix Code ExamplesMaxBotix Code Examples
MaxBotix Code ExamplesMaxBotix Inc
 
Arduino Final Project
Arduino Final ProjectArduino Final Project
Arduino Final ProjectBach Nguyen
 
Mdp plus 2.1
Mdp plus 2.1Mdp plus 2.1
Mdp plus 2.1boedax
 
Arduino cic3
Arduino cic3Arduino cic3
Arduino cic3Jeni Shah
 
Arduino: Analog I/O
Arduino: Analog I/OArduino: Analog I/O
Arduino: Analog I/OJune-Hao Hou
 
Microcontroller (8051) general and simple alp n cprograms
Microcontroller (8051) general and simple alp n cprogramsMicrocontroller (8051) general and simple alp n cprograms
Microcontroller (8051) general and simple alp n cprogramsVedavyas PBurli
 
Lathe Spindle Sensor
Lathe Spindle SensorLathe Spindle Sensor
Lathe Spindle SensorJoeCritt
 
Handling Asynchronous Events in MCUs
Handling Asynchronous Events in MCUsHandling Asynchronous Events in MCUs
Handling Asynchronous Events in MCUsCorrado Santoro
 
Programming A Robot Using
Programming A Robot UsingProgramming A Robot Using
Programming A Robot UsingSpitiq
 
SENDER It is a helmet that contains a sensor for gases, vital s.pdf
SENDER  It is a helmet that contains a sensor for gases, vital s.pdfSENDER  It is a helmet that contains a sensor for gases, vital s.pdf
SENDER It is a helmet that contains a sensor for gases, vital s.pdfalertshoeshingkimand
 
Twin wheeler modified for arduino simplified serial protocol to sabertooth v2
Twin wheeler modified for arduino simplified serial protocol to sabertooth v2Twin wheeler modified for arduino simplified serial protocol to sabertooth v2
Twin wheeler modified for arduino simplified serial protocol to sabertooth v2josnihmurni2907
 

Similar to GENESIS BOARD MINI SUMO ROBOT PROGRAMFOR 3 OPPONENT SENSOR, .pdf (20)

Twin wheeler modified for arduino simplified serial protocol to sabertooth v22
Twin wheeler modified for arduino simplified serial protocol to sabertooth v22Twin wheeler modified for arduino simplified serial protocol to sabertooth v22
Twin wheeler modified for arduino simplified serial protocol to sabertooth v22
 
Ldr based line follower robot
Ldr based line follower robotLdr based line follower robot
Ldr based line follower robot
 
Scottish Ruby Conference 2010 Arduino, Ruby RAD
Scottish Ruby Conference 2010 Arduino, Ruby RADScottish Ruby Conference 2010 Arduino, Ruby RAD
Scottish Ruby Conference 2010 Arduino, Ruby RAD
 
PROGRAMMING ADC and DAC-mbed.pdf
PROGRAMMING ADC and DAC-mbed.pdfPROGRAMMING ADC and DAC-mbed.pdf
PROGRAMMING ADC and DAC-mbed.pdf
 
Arduino Programming
Arduino ProgrammingArduino Programming
Arduino Programming
 
MaxBotix Code Examples
MaxBotix Code ExamplesMaxBotix Code Examples
MaxBotix Code Examples
 
Hexapod ppt
Hexapod pptHexapod ppt
Hexapod ppt
 
Sbaw090908
Sbaw090908Sbaw090908
Sbaw090908
 
Arduino Final Project
Arduino Final ProjectArduino Final Project
Arduino Final Project
 
Mdp plus 2.1
Mdp plus 2.1Mdp plus 2.1
Mdp plus 2.1
 
Arduino cic3
Arduino cic3Arduino cic3
Arduino cic3
 
Arduino: Analog I/O
Arduino: Analog I/OArduino: Analog I/O
Arduino: Analog I/O
 
Microcontroller (8051) general and simple alp n cprograms
Microcontroller (8051) general and simple alp n cprogramsMicrocontroller (8051) general and simple alp n cprograms
Microcontroller (8051) general and simple alp n cprograms
 
Lathe Spindle Sensor
Lathe Spindle SensorLathe Spindle Sensor
Lathe Spindle Sensor
 
Handling Asynchronous Events in MCUs
Handling Asynchronous Events in MCUsHandling Asynchronous Events in MCUs
Handling Asynchronous Events in MCUs
 
Programming A Robot Using
Programming A Robot UsingProgramming A Robot Using
Programming A Robot Using
 
Lampiran 1.programdocx
Lampiran 1.programdocxLampiran 1.programdocx
Lampiran 1.programdocx
 
SENDER It is a helmet that contains a sensor for gases, vital s.pdf
SENDER  It is a helmet that contains a sensor for gases, vital s.pdfSENDER  It is a helmet that contains a sensor for gases, vital s.pdf
SENDER It is a helmet that contains a sensor for gases, vital s.pdf
 
Twin wheeler modified for arduino simplified serial protocol to sabertooth v2
Twin wheeler modified for arduino simplified serial protocol to sabertooth v2Twin wheeler modified for arduino simplified serial protocol to sabertooth v2
Twin wheeler modified for arduino simplified serial protocol to sabertooth v2
 
renesas
renesasrenesas
renesas
 

More from alltiusind

Given a doubly-linked list (2,3,4,5,6,7), node 2 s pointer(s) point(.pdf
 Given a doubly-linked list (2,3,4,5,6,7), node 2 s pointer(s) point(.pdf Given a doubly-linked list (2,3,4,5,6,7), node 2 s pointer(s) point(.pdf
Given a doubly-linked list (2,3,4,5,6,7), node 2 s pointer(s) point(.pdfalltiusind
 
Given a list, remove item with index 0,4,5 from list if there exist a.pdf
 Given a list, remove item with index 0,4,5 from list if there exist a.pdf Given a list, remove item with index 0,4,5 from list if there exist a.pdf
Given a list, remove item with index 0,4,5 from list if there exist a.pdfalltiusind
 
Georgia Kennel uses tenant-days as its measure of activity; an animal.pdf
 Georgia Kennel uses tenant-days as its measure of activity; an animal.pdf Georgia Kennel uses tenant-days as its measure of activity; an animal.pdf
Georgia Kennel uses tenant-days as its measure of activity; an animal.pdfalltiusind
 
Georgia Kennel uses tenant-days as its measure of activity; an anmal .pdf
 Georgia Kennel uses tenant-days as its measure of activity; an anmal .pdf Georgia Kennel uses tenant-days as its measure of activity; an anmal .pdf
Georgia Kennel uses tenant-days as its measure of activity; an anmal .pdfalltiusind
 
George Morton, gerente del departamento de mantenimiento de un gr.pdf
 George Morton, gerente del departamento de mantenimiento de un gr.pdf George Morton, gerente del departamento de mantenimiento de un gr.pdf
George Morton, gerente del departamento de mantenimiento de un gr.pdfalltiusind
 
Get an educations A sucvey asked 32,114 people how much confidence th.pdf
 Get an educations A sucvey asked 32,114 people how much confidence th.pdf Get an educations A sucvey asked 32,114 people how much confidence th.pdf
Get an educations A sucvey asked 32,114 people how much confidence th.pdfalltiusind
 
General Instructions - Submit your solution no later than 1159pm ET .pdf
 General Instructions - Submit your solution no later than 1159pm ET .pdf General Instructions - Submit your solution no later than 1159pm ET .pdf
General Instructions - Submit your solution no later than 1159pm ET .pdfalltiusind
 
Generate and upload a PDA in JFF format for the following grammar Hi.pdf
 Generate and upload a PDA in JFF format for the following grammar Hi.pdf Generate and upload a PDA in JFF format for the following grammar Hi.pdf
Generate and upload a PDA in JFF format for the following grammar Hi.pdfalltiusind
 
General exceptions to.pdf
 General exceptions to.pdf General exceptions to.pdf
General exceptions to.pdfalltiusind
 
Gator Investments provides financial services related to investment s.pdf
 Gator Investments provides financial services related to investment s.pdf Gator Investments provides financial services related to investment s.pdf
Gator Investments provides financial services related to investment s.pdfalltiusind
 
Gotthelf Clinic uses client-visits as its measure of activity. During.pdf
 Gotthelf Clinic uses client-visits as its measure of activity. During.pdf Gotthelf Clinic uses client-visits as its measure of activity. During.pdf
Gotthelf Clinic uses client-visits as its measure of activity. During.pdfalltiusind
 
Gopton Company Is considering a capptal bodgeting froject that would .pdf
 Gopton Company Is considering a capptal bodgeting froject that would .pdf Gopton Company Is considering a capptal bodgeting froject that would .pdf
Gopton Company Is considering a capptal bodgeting froject that would .pdfalltiusind
 
Gordon Millers job shop has four work areas, A, B, C, and D. Distanc.pdf
 Gordon Millers job shop has four work areas, A, B, C, and D. Distanc.pdf Gordon Millers job shop has four work areas, A, B, C, and D. Distanc.pdf
Gordon Millers job shop has four work areas, A, B, C, and D. Distanc.pdfalltiusind
 
Given the following relation staff property staffinspection Express.pdf
 Given the following relation staff property staffinspection Express.pdf Given the following relation staff property staffinspection Express.pdf
Given the following relation staff property staffinspection Express.pdfalltiusind
 
Globalization and Tourism Development - western values, authenticity,.pdf
 Globalization and Tourism Development - western values, authenticity,.pdf Globalization and Tourism Development - western values, authenticity,.pdf
Globalization and Tourism Development - western values, authenticity,.pdfalltiusind
 
Give you two list, return True if they have common item, False if the.pdf
 Give you two list, return True if they have common item, False if the.pdf Give you two list, return True if they have common item, False if the.pdf
Give you two list, return True if they have common item, False if the.pdfalltiusind
 
Glycolaldehyde inhibits the Calvin cycle by inhibiting RuBP. What Cal.pdf
 Glycolaldehyde inhibits the Calvin cycle by inhibiting RuBP. What Cal.pdf Glycolaldehyde inhibits the Calvin cycle by inhibiting RuBP. What Cal.pdf
Glycolaldehyde inhibits the Calvin cycle by inhibiting RuBP. What Cal.pdfalltiusind
 
Glucans are small pieces of the cell walls of molds that may cause .pdf
 Glucans are small pieces of the cell walls of molds that may cause .pdf Glucans are small pieces of the cell walls of molds that may cause .pdf
Glucans are small pieces of the cell walls of molds that may cause .pdfalltiusind
 
Give Me Your Money bank knows they get on average 18 calls per hour o.pdf
 Give Me Your Money bank knows they get on average 18 calls per hour o.pdf Give Me Your Money bank knows they get on average 18 calls per hour o.pdf
Give Me Your Money bank knows they get on average 18 calls per hour o.pdfalltiusind
 
Given the following BNF (1) Rewrite the above BNF to reflect the fol.pdf
 Given the following BNF (1) Rewrite the above BNF to reflect the fol.pdf Given the following BNF (1) Rewrite the above BNF to reflect the fol.pdf
Given the following BNF (1) Rewrite the above BNF to reflect the fol.pdfalltiusind
 

More from alltiusind (20)

Given a doubly-linked list (2,3,4,5,6,7), node 2 s pointer(s) point(.pdf
 Given a doubly-linked list (2,3,4,5,6,7), node 2 s pointer(s) point(.pdf Given a doubly-linked list (2,3,4,5,6,7), node 2 s pointer(s) point(.pdf
Given a doubly-linked list (2,3,4,5,6,7), node 2 s pointer(s) point(.pdf
 
Given a list, remove item with index 0,4,5 from list if there exist a.pdf
 Given a list, remove item with index 0,4,5 from list if there exist a.pdf Given a list, remove item with index 0,4,5 from list if there exist a.pdf
Given a list, remove item with index 0,4,5 from list if there exist a.pdf
 
Georgia Kennel uses tenant-days as its measure of activity; an animal.pdf
 Georgia Kennel uses tenant-days as its measure of activity; an animal.pdf Georgia Kennel uses tenant-days as its measure of activity; an animal.pdf
Georgia Kennel uses tenant-days as its measure of activity; an animal.pdf
 
Georgia Kennel uses tenant-days as its measure of activity; an anmal .pdf
 Georgia Kennel uses tenant-days as its measure of activity; an anmal .pdf Georgia Kennel uses tenant-days as its measure of activity; an anmal .pdf
Georgia Kennel uses tenant-days as its measure of activity; an anmal .pdf
 
George Morton, gerente del departamento de mantenimiento de un gr.pdf
 George Morton, gerente del departamento de mantenimiento de un gr.pdf George Morton, gerente del departamento de mantenimiento de un gr.pdf
George Morton, gerente del departamento de mantenimiento de un gr.pdf
 
Get an educations A sucvey asked 32,114 people how much confidence th.pdf
 Get an educations A sucvey asked 32,114 people how much confidence th.pdf Get an educations A sucvey asked 32,114 people how much confidence th.pdf
Get an educations A sucvey asked 32,114 people how much confidence th.pdf
 
General Instructions - Submit your solution no later than 1159pm ET .pdf
 General Instructions - Submit your solution no later than 1159pm ET .pdf General Instructions - Submit your solution no later than 1159pm ET .pdf
General Instructions - Submit your solution no later than 1159pm ET .pdf
 
Generate and upload a PDA in JFF format for the following grammar Hi.pdf
 Generate and upload a PDA in JFF format for the following grammar Hi.pdf Generate and upload a PDA in JFF format for the following grammar Hi.pdf
Generate and upload a PDA in JFF format for the following grammar Hi.pdf
 
General exceptions to.pdf
 General exceptions to.pdf General exceptions to.pdf
General exceptions to.pdf
 
Gator Investments provides financial services related to investment s.pdf
 Gator Investments provides financial services related to investment s.pdf Gator Investments provides financial services related to investment s.pdf
Gator Investments provides financial services related to investment s.pdf
 
Gotthelf Clinic uses client-visits as its measure of activity. During.pdf
 Gotthelf Clinic uses client-visits as its measure of activity. During.pdf Gotthelf Clinic uses client-visits as its measure of activity. During.pdf
Gotthelf Clinic uses client-visits as its measure of activity. During.pdf
 
Gopton Company Is considering a capptal bodgeting froject that would .pdf
 Gopton Company Is considering a capptal bodgeting froject that would .pdf Gopton Company Is considering a capptal bodgeting froject that would .pdf
Gopton Company Is considering a capptal bodgeting froject that would .pdf
 
Gordon Millers job shop has four work areas, A, B, C, and D. Distanc.pdf
 Gordon Millers job shop has four work areas, A, B, C, and D. Distanc.pdf Gordon Millers job shop has four work areas, A, B, C, and D. Distanc.pdf
Gordon Millers job shop has four work areas, A, B, C, and D. Distanc.pdf
 
Given the following relation staff property staffinspection Express.pdf
 Given the following relation staff property staffinspection Express.pdf Given the following relation staff property staffinspection Express.pdf
Given the following relation staff property staffinspection Express.pdf
 
Globalization and Tourism Development - western values, authenticity,.pdf
 Globalization and Tourism Development - western values, authenticity,.pdf Globalization and Tourism Development - western values, authenticity,.pdf
Globalization and Tourism Development - western values, authenticity,.pdf
 
Give you two list, return True if they have common item, False if the.pdf
 Give you two list, return True if they have common item, False if the.pdf Give you two list, return True if they have common item, False if the.pdf
Give you two list, return True if they have common item, False if the.pdf
 
Glycolaldehyde inhibits the Calvin cycle by inhibiting RuBP. What Cal.pdf
 Glycolaldehyde inhibits the Calvin cycle by inhibiting RuBP. What Cal.pdf Glycolaldehyde inhibits the Calvin cycle by inhibiting RuBP. What Cal.pdf
Glycolaldehyde inhibits the Calvin cycle by inhibiting RuBP. What Cal.pdf
 
Glucans are small pieces of the cell walls of molds that may cause .pdf
 Glucans are small pieces of the cell walls of molds that may cause .pdf Glucans are small pieces of the cell walls of molds that may cause .pdf
Glucans are small pieces of the cell walls of molds that may cause .pdf
 
Give Me Your Money bank knows they get on average 18 calls per hour o.pdf
 Give Me Your Money bank knows they get on average 18 calls per hour o.pdf Give Me Your Money bank knows they get on average 18 calls per hour o.pdf
Give Me Your Money bank knows they get on average 18 calls per hour o.pdf
 
Given the following BNF (1) Rewrite the above BNF to reflect the fol.pdf
 Given the following BNF (1) Rewrite the above BNF to reflect the fol.pdf Given the following BNF (1) Rewrite the above BNF to reflect the fol.pdf
Given the following BNF (1) Rewrite the above BNF to reflect the fol.pdf
 

Recently uploaded

POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsanshu789521
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTiammrhaywood
 
Class 11 Legal Studies Ch-1 Concept of State .pdf
Class 11 Legal Studies Ch-1 Concept of State .pdfClass 11 Legal Studies Ch-1 Concept of State .pdf
Class 11 Legal Studies Ch-1 Concept of State .pdfakmcokerachita
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application ) Sakshi Ghasle
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdfssuser54595a
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...M56BOOKSTORE PRODUCT/SERVICE
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxContemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxRoyAbrique
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesFatimaKhan178732
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfSumit Tiwari
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17Celine George
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionSafetyChain Software
 

Recently uploaded (20)

POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha elections
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
Class 11 Legal Studies Ch-1 Concept of State .pdf
Class 11 Legal Studies Ch-1 Concept of State .pdfClass 11 Legal Studies Ch-1 Concept of State .pdf
Class 11 Legal Studies Ch-1 Concept of State .pdf
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application )
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
 
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxContemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and Actinides
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory Inspection
 

GENESIS BOARD MINI SUMO ROBOT PROGRAMFOR 3 OPPONENT SENSOR, .pdf

  • 1. / GENESIS BOARD MINI SUMO ROBOT PROGRAM //FOR 3 OPPONENT SENSOR, 2 EDGE SENSOR // JSUMO 01/2020 /////////////////////////////////////// //MOTOR CONTROL int RPwm = 11; int RDir = 13; int LPwm = 3; int LDir = 12; //LED & BUZZER int Buzzer = 9; int ArduLed = 8; //EDGE & CONTRAST SENSORS int Redge = A0; int Ledge = A1; //TRIMPOTS int SPD = A7; int TRN = A6; //OPPONENT SENSORS int LSens = A4; int RSens = A2; int MSens = A3;
  • 2. int LFSens = A5; int RFSens = 4; // DIPSWITCH & BUTTON int Button = 10; // Can be used as start pin too. int DS1 = 5; int DS2 = 6; int DS3 = 7; //VALUES int Speed =50; int MaxSpeed = 80; // Idle Speed while no sensor giving data. int TurnSpeed = 65; // Left and Right Forward Turning Speed int EdgeTurn = 150; // Turning Time variable when minisumo sees white line int Duration; // Turning Time at minisumo starting. int LastValue = 5; // Last Value Variable for remembering last Opponent sensor sense. void setup() { pinMode(LSens, INPUT); // Left Opponent Sensor Input pinMode(RSens, INPUT); // Right Opponent Sensor Input pinMode(MSens, INPUT); // Middle Opponent Sensor Input pinMode(Buzzer, OUTPUT); // Buzzer Declared as Output pinMode(ArduLed, OUTPUT); // Buzzer Declared as Output pinMode(Button, INPUT); // Buzzer Declared as Output pinMode(RPwm, OUTPUT); // Four PWM Channel Declared as Output pinMode(RDir, OUTPUT);
  • 3. pinMode(LPwm, OUTPUT); pinMode(LDir, OUTPUT); digitalWrite(Buzzer, LOW); // Buzzer Pin Made Low for Silence digitalWrite(ArduLed, LOW); // Arduino Mode Led Made Low digitalWrite(DS1, HIGH); // 3 Dipswitch Pin Pullups Made digitalWrite(DS2, HIGH); digitalWrite(DS3, HIGH); digitalWrite(LSens, HIGH); // Opponent Sensor Pullups Made digitalWrite(RSens, HIGH); digitalWrite(LFSens, HIGH); digitalWrite(RFSens, HIGH); digitalWrite(MSens, HIGH); Serial.begin(9600); } //Motor Control Function void Set_Motor (float Lval, float Rval, int timex){ Lval = Lval*2.5; Rval = Rval*2.5; if (Lval >=0) { analogWrite(LPwm, Lval); digitalWrite(LDir, LOW); } else { Lval=abs(Lval); digitalWrite(LDir, HIGH); analogWrite(LPwm, Lval); } if (Rval >=0) { analogWrite(RPwm, Rval); digitalWrite(RDir, HIGH); } else {
  • 4. Rval=abs(Rval); digitalWrite(RDir, LOW); analogWrite(RPwm, Rval); } //If you want to see Speed Values please uncomment bottom line. // Serial.print(Rval); Serial.print(-); Serial.println(Lval); delay(timex); } void loop() { digitalWrite(RPwm, LOW); digitalWrite(LPwm, LOW); tone(Buzzer, 18, 100); // Pin, Frequency, Duration ////////////////////////////////////////////// // This function below, used for stopping robot while no button is pushed or Microstart is not triggered. while (digitalRead(Button)==0) { Serial.println(Button Press Waited); Set_Motor(0,0,1); /// Sensor Control While Waiting The Button Press /// if ( digitalRead(MSens)==LOW || digitalRead(RSens)==LOW || digitalRead(LSens)== LOW || digitalRead(RFSens)==LOW || digitalRead(LFSens)== LOW || analogRead(Redge)< 100 || analogRead(Ledge)< 100 ) { digitalWrite(ArduLed, HIGH);} else { digitalWrite(ArduLed, LOW); } } /////////////////////////////////////////////// if (digitalRead(Button)==1) { Duration=(analogRead(TRN)/5); // Duration variable based on TRN (A6) trimpot Duration=205-Duration; // Serial.println(5 Sec Routine Started); for (int i = 0; i < 5; i++){ digitalWrite(Buzzer, HIGH); digitalWrite(ArduLed, HIGH);
  • 5. delay(100); digitalWrite(Buzzer, LOW); digitalWrite(ArduLed, LOW); delay(900); } if (digitalRead(DS1)==0 && digitalRead(DS2)==1 && digitalRead(DS3)==1){ Serial.print(LEFT TURN); Set_Motor(-100,100,Duration); // } else if (digitalRead(DS1)==0 && digitalRead(DS2)==0 && digitalRead(DS3)==0) { Serial.print(MIDDLE DIRECT); Set_Motor(80,80,2); } else if (digitalRead(DS1)==1 && digitalRead(DS2)==1 && digitalRead(DS3)==0){ Serial.print(Sag); Set_Motor(100,-100,Duration); } else if (digitalRead(DS1)==1 && digitalRead(DS2)==0 && digitalRead(DS3)==0){ Serial.print(Left Circle); Set_Motor(100,36,650); } else if (digitalRead(DS1)==0 && digitalRead(DS2)==0 && digitalRead(DS3)==1){ Serial.print(Right Circle); Set_Motor(36,100,650); } else if (digitalRead(DS1)==0 && digitalRead(DS2)==1 && digitalRead(DS3)==0){ Serial.print(Reverse 180); Set_Motor(-100,100,Duration*2); // One Duration time is for 90 degree, so we multiply by 2. } Serial.print(OK); digitalWrite(Buzzer, LOW); EdgeTurn=(analogRead(TRN)/5); // Raw value comes with 0 to 1023, we divide it for 0 t0 205 mS turning time. EdgeTurn=205-EdgeTurn; // }
  • 6. //Main Loop while(1) { /// Edge Sensor Control Routine /// digitalWrite(ArduLed, LOW); if (analogRead(Ledge)<300 && analogRead(Redge)> 300) { digitalWrite(Buzzer, LOW); digitalWrite(ArduLed, HIGH); Set_Motor(-100, -100,55); // Backward for 55 mS. Set_Motor(-100, 100, EdgeTurn); // Left Backward, Right Forward, Turning Time Based on ETRN Trimpot LastValue=5; } else if (analogRead(Ledge)> 300 && analogRead(Redge)< 300) { digitalWrite(Buzzer, LOW); digitalWrite(ArduLed, HIGH); Set_Motor(-100, -100,55); // Backward for 55 mS. Set_Motor(100, -100, EdgeTurn); // Right Backward, Left Forward, Turning Time Based on ETRN Trimpot LastValue=5; } else if (analogRead(Ledge)< 300 && analogRead(Redge)< 300) { digitalWrite(Buzzer, LOW); digitalWrite(ArduLed, HIGH); Set_Motor(-100, -100,55); // Backward for 55 mS. Set_Motor(100, -100, EdgeTurn); // Right Backward, Left Forward, Turning Time Based on ETRN Trimpot LastValue=5; }else /// Opponent Sensor Control Routine /// // Please uncomment below line if yu are using microstart, When microstart gives 0V it will stop motors. //while (digitalRead(Button)==LOW) {Set_Motor(0, 0, 20); digitalWrite(Buzzer, HIGH); LastValue=3;} digitalWrite(Buzzer, LOW);
  • 7. if (digitalRead(MSens)==LOW) {Set_Motor(MaxSpeed, MaxSpeed,1); digitalWrite(Buzzer, HIGH); LastValue=5;} else if (digitalRead(LSens)== LOW) {Set_Motor(-40, TurnSpeed,1); digitalWrite(Buzzer, HIGH); LastValue=7;} else if (digitalRead(RSens)==LOW) {Set_Motor(TurnSpeed, -40,1); digitalWrite(Buzzer, HIGH); LastValue=3;} else if (digitalRead(LFSens)== LOW) {Set_Motor(-40, TurnSpeed,1); digitalWrite(Buzzer, HIGH); LastValue=7;} else if (digitalRead(RFSens)==LOW) {Set_Motor(TurnSpeed, -40,1); digitalWrite(Buzzer, HIGH); LastValue=3;} else { digitalWrite(Buzzer, LOW); Speed=(analogRead(SPD)/10.3); // This raw speed value comes with 0 to 1023 so we divide to 10.3 After that it is 0 to 99 integer. Speed=100-Speed; // This is used for reversing trimpot dial direction at board. if (LastValue==5) { Set_Motor(Speed, Speed,1);} else // Forward, Based on SPD (A7) Trimpot if (LastValue==7) { Set_Motor(-20, Speed,2);} else // Left Turning Based on SPD (A7) Trimpot if (LastValue==3) { Set_Motor(Speed, -20,2);} // Right Turning Based on SPD (A7) Trimpot } } } Can you integrate the above code according to the items written below? Now program your robot to follow a square shaped path, as follows: i. Go forward for one second, ii. Make a 90 degree left turn, iii. Go to step (i). iv. Stop after four turns.
  • 8. / GENESIS BOARD MINI SUMO ROBOT PROGRAM //FOR 3 OPPONENT SENSOR, 2 EDGE SENSOR // JSUMO 01/2020 /////////////////////////////////////// //MOTOR CONTROL int RPwm = 11; int RDir = 13; int LPwm = 3; int LDir = 12; //LED & BUZZER int Buzzer = 9; int ArduLed = 8; //EDGE & CONTRAST SENSORS int Redge = A0; int Ledge = A1; //TRIMPOTS int SPD = A7; int TRN = A6; //OPPONENT SENSORS int LSens = A4; int RSens = A2; int MSens = A3;
  • 9. int LFSens = A5; int RFSens = 4; // DIPSWITCH & BUTTON int Button = 10; // Can be used as start pin too. int DS1 = 5; int DS2 = 6; int DS3 = 7; //VALUES int Speed =50; int MaxSpeed = 80; // Idle Speed while no sensor giving data. int TurnSpeed = 65; // Left and Right Forward Turning Speed int EdgeTurn = 150; // Turning Time variable when minisumo sees white line int Duration; // Turning Time at minisumo starting. int LastValue = 5; // Last Value Variable for remembering last Opponent sensor sense. void setup() { pinMode(LSens, INPUT); // Left Opponent Sensor Input pinMode(RSens, INPUT); // Right Opponent Sensor Input pinMode(MSens, INPUT); // Middle Opponent Sensor Input pinMode(Buzzer, OUTPUT); // Buzzer Declared as Output pinMode(ArduLed, OUTPUT); // Buzzer Declared as Output pinMode(Button, INPUT); // Buzzer Declared as Output pinMode(RPwm, OUTPUT); // Four PWM Channel Declared as Output pinMode(RDir, OUTPUT); pinMode(LPwm, OUTPUT); pinMode(LDir, OUTPUT);
  • 10. digitalWrite(Buzzer, LOW); // Buzzer Pin Made Low for Silence digitalWrite(ArduLed, LOW); // Arduino Mode Led Made Low digitalWrite(DS1, HIGH); // 3 Dipswitch Pin Pullups Made digitalWrite(DS2, HIGH); digitalWrite(DS3, HIGH); digitalWrite(LSens, HIGH); // Opponent Sensor Pullups Made digitalWrite(RSens, HIGH); digitalWrite(LFSens, HIGH); digitalWrite(RFSens, HIGH); digitalWrite(MSens, HIGH); Serial.begin(9600); } //Motor Control Function void Set_Motor (float Lval, float Rval, int timex){ Lval = Lval*2.5; Rval = Rval*2.5; if (Lval >=0) { analogWrite(LPwm, Lval); digitalWrite(LDir, LOW); } else { Lval=abs(Lval); digitalWrite(LDir, HIGH); analogWrite(LPwm, Lval); } if (Rval >=0) { analogWrite(RPwm, Rval); digitalWrite(RDir, HIGH); } else { Rval=abs(Rval); digitalWrite(RDir, LOW);
  • 11. analogWrite(RPwm, Rval); } //If you want to see Speed Values please uncomment bottom line. // Serial.print(Rval); Serial.print(-); Serial.println(Lval); delay(timex); } void loop() { digitalWrite(RPwm, LOW); digitalWrite(LPwm, LOW); tone(Buzzer, 18, 100); // Pin, Frequency, Duration ////////////////////////////////////////////// // This function below, used for stopping robot while no button is pushed or Microstart is not triggered. while (digitalRead(Button)==0) { Serial.println(Button Press Waited); Set_Motor(0,0,1); /// Sensor Control While Waiting The Button Press /// if ( digitalRead(MSens)==LOW || digitalRead(RSens)==LOW || digitalRead(LSens)== LOW || digitalRead(RFSens)==LOW || digitalRead(LFSens)== LOW || analogRead(Redge)< 100 || analogRead(Ledge)< 100 ) { digitalWrite(ArduLed, HIGH);} else { digitalWrite(ArduLed, LOW); } } /////////////////////////////////////////////// if (digitalRead(Button)==1) { Duration=(analogRead(TRN)/5); // Duration variable based on TRN (A6) trimpot Duration=205-Duration; // Serial.println(5 Sec Routine Started); for (int i = 0; i < 5; i++){ digitalWrite(Buzzer, HIGH); digitalWrite(ArduLed, HIGH); delay(100); digitalWrite(Buzzer, LOW); digitalWrite(ArduLed, LOW); delay(900); }
  • 12. if (digitalRead(DS1)==0 && digitalRead(DS2)==1 && digitalRead(DS3)==1){ Serial.print(LEFT TURN); Set_Motor(-100,100,Duration); // } else if (digitalRead(DS1)==0 && digitalRead(DS2)==0 && digitalRead(DS3)==0) { Serial.print(MIDDLE DIRECT); Set_Motor(80,80,2); } else if (digitalRead(DS1)==1 && digitalRead(DS2)==1 && digitalRead(DS3)==0){ Serial.print(Sag); Set_Motor(100,-100,Duration); } else if (digitalRead(DS1)==1 && digitalRead(DS2)==0 && digitalRead(DS3)==0){ Serial.print(Left Circle); Set_Motor(100,36,650); } else if (digitalRead(DS1)==0 && digitalRead(DS2)==0 && digitalRead(DS3)==1){ Serial.print(Right Circle); Set_Motor(36,100,650); } else if (digitalRead(DS1)==0 && digitalRead(DS2)==1 && digitalRead(DS3)==0){ Serial.print(Reverse 180); Set_Motor(-100,100,Duration*2); // One Duration time is for 90 degree, so we multiply by 2. } Serial.print(OK); digitalWrite(Buzzer, LOW); EdgeTurn=(analogRead(TRN)/5); // Raw value comes with 0 to 1023, we divide it for 0 t0 205 mS turning time. EdgeTurn=205-EdgeTurn; // } //Main Loop
  • 13. while(1) { /// Edge Sensor Control Routine /// digitalWrite(ArduLed, LOW); if (analogRead(Ledge)<300 && analogRead(Redge)> 300) { digitalWrite(Buzzer, LOW); digitalWrite(ArduLed, HIGH); Set_Motor(-100, -100,55); // Backward for 55 mS. Set_Motor(-100, 100, EdgeTurn); // Left Backward, Right Forward, Turning Time Based on ETRN Trimpot LastValue=5; } else if (analogRead(Ledge)> 300 && analogRead(Redge)< 300) { digitalWrite(Buzzer, LOW); digitalWrite(ArduLed, HIGH); Set_Motor(-100, -100,55); // Backward for 55 mS. Set_Motor(100, -100, EdgeTurn); // Right Backward, Left Forward, Turning Time Based on ETRN Trimpot LastValue=5; } else if (analogRead(Ledge)< 300 && analogRead(Redge)< 300) { digitalWrite(Buzzer, LOW); digitalWrite(ArduLed, HIGH); Set_Motor(-100, -100,55); // Backward for 55 mS. Set_Motor(100, -100, EdgeTurn); // Right Backward, Left Forward, Turning Time Based on ETRN Trimpot LastValue=5; }else /// Opponent Sensor Control Routine /// // Please uncomment below line if yu are using microstart, When microstart gives 0V it will stop motors. //while (digitalRead(Button)==LOW) {Set_Motor(0, 0, 20); digitalWrite(Buzzer, HIGH); LastValue=3;} digitalWrite(Buzzer, LOW); if (digitalRead(MSens)==LOW) {Set_Motor(MaxSpeed, MaxSpeed,1); digitalWrite(Buzzer, HIGH); LastValue=5;} else
  • 14. if (digitalRead(LSens)== LOW) {Set_Motor(-40, TurnSpeed,1); digitalWrite(Buzzer, HIGH); LastValue=7;} else if (digitalRead(RSens)==LOW) {Set_Motor(TurnSpeed, -40,1); digitalWrite(Buzzer, HIGH); LastValue=3;} else if (digitalRead(LFSens)== LOW) {Set_Motor(-40, TurnSpeed,1); digitalWrite(Buzzer, HIGH); LastValue=7;} else if (digitalRead(RFSens)==LOW) {Set_Motor(TurnSpeed, -40,1); digitalWrite(Buzzer, HIGH); LastValue=3;} else { digitalWrite(Buzzer, LOW); Speed=(analogRead(SPD)/10.3); // This raw speed value comes with 0 to 1023 so we divide to 10.3 After that it is 0 to 99 integer. Speed=100-Speed; // This is used for reversing trimpot dial direction at board. if (LastValue==5) { Set_Motor(Speed, Speed,1);} else // Forward, Based on SPD (A7) Trimpot if (LastValue==7) { Set_Motor(-20, Speed,2);} else // Left Turning Based on SPD (A7) Trimpot if (LastValue==3) { Set_Motor(Speed, -20,2);} // Right Turning Based on SPD (A7) Trimpot } } } Can you integrate the above code according to the items written below? Now program your robot to follow a square shaped path, as follows: i. Go forward for one second, ii. Make a 90 degree left turn, iii. Go to step (i). iv. Stop after four turns. Now program your robot to follow a square shaped path, as follows: i. Go forward for one second,
  • 15. ii. Make a 90 degree left turn, iii. Go to step (i). iv. Stop after four turns.