Grace YipRachel Vong
Published

Team Orange's Unconventional Sumo Bot Controller

Final Unconventional Sumo Bot Controller UCF-Spring 2025-DIG3602C-Davis TEAM ORANGE

BeginnerShowcase (no instructions)53
Team Orange's Unconventional Sumo Bot Controller

Things used in this project

Hardware components

Arduino UNO
Arduino UNO
×1
Breadboard (generic)
Breadboard (generic)
×1
Resistor 100k ohm
Resistor 100k ohm
×1
Resistor 2.21k ohm
Resistor 2.21k ohm
×1
light sensor
×1
LED RGB light
×1

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Schematics

Diagram

Code

Code

C/C++
#include <SoftwareSerial.h>
SoftwareSerial mySerial(3, 2); // Bluetooth TX, RX

const int greenLEDPin = 9;
const int redLEDPin   = 10;
const int blueLEDPin  = 11;

const int redSensorPin   = A0;
const int greenSensorPin = A1;
const int blueSensorPin  = A2;

int redValue = 0;
int greenValue = 0;
int blueValue = 0;

void setup() {
  Serial.begin(9600);
  mySerial.begin(38400);

  pinMode(greenLEDPin, OUTPUT);
  pinMode(redLEDPin, OUTPUT);
  pinMode(blueLEDPin, OUTPUT);
}

void loop() {

  // ---- Read sensors ----
  int redSensorValue   = analogRead(redSensorPin);
  delay(3);
  int greenSensorValue = analogRead(greenSensorPin);
  delay(3);
  int blueSensorValue  = analogRead(blueSensorPin);


  redValue   = redSensorValue / 4;
  greenValue = greenSensorValue / 4;
  blueValue  = blueSensorValue / 4;

  int i = 0;

  if(redValue <= 150 && blueValue > 150 && greenValue > 150) // If button is pressed... 
  {
    do
    {
    mySerial.write("F"); // ... Send this letter to the bot. F is being sent here.
    i++;
    } while (i < 500);
   
  
  }
    else if (redValue <= 150 && blueValue <= 150 && greenValue > 150)
  {
    do
    {
    mySerial.write("B");
      i++;
    } while (i < 500);

  }
    else if (greenValue <= 150 && redValue > 150 && blueValue > 150)
  {
    do
    {
    mySerial.write("L");
    i++;
    } while (i < 500);

  }
    else if (blueValue <= 150 && redValue > 150 && greenValue > 150)
  {
    do
    {
    mySerial.write("R");
    i++;
    } while (i < 500);

  }


  // ---- SHOW LED COLOR (after reading sensors!) ----
  // Dim LED so sensors aren't blinded
  analogWrite(redLEDPin, redValue / 3);
  analogWrite(greenLEDPin, greenValue / 3);
  analogWrite(blueLEDPin, blueValue / 3);


}

Credits

Grace Yip
2 projects • 0 followers
Rachel Vong
2 projects • 0 followers

Comments