Preparation

Preparation Code

Arduino.h: Arduino core library ("digitalWrite(), analogRead(), and pinMode())

ENA & ENB: Enable pins for controlling motor speed.

IN1, IN2, IN3, and IN4: Pins for each of the four DC motors.

STBY: used to enable/disable the motor driver.

Preparation cont.

Preparation Code

The setup function prepares the robot to receive code.

digitalWrite sets the motor driver to high and enables the pins to send voltage to the DC motors.

All pins are set to output using pinmode, this allows the expansion board to send commands to the motors.

Serial.begin sets the baud rate, communication between the board and the motors, at 9600 bits per second.

House floor plan

Objective: Use existing house floor plan and scale down measurements, drive the dimensions of the house as well as the squared inside the house.

Movement

Code to move robot

Must be able to move the robot Forward, Backward, Left, and Right.

Forward and Reverse delay is based on the amount of time required to traverse a given distance.

Moves the same way a Track Tractor moves.

Right and Left delay is based on a 45˚ movement every 80 milliseconds.

Testing Movement

Testing proved to be a success.

Stop-Start function needed to be created in order to stop voltage from being carried over to the next command.

Outer Perimeter

Code to drive outer perimeter

If-else statement to check for valid sensor value.

Calling movement functions with scaled-down measurements being passed in.

Stop-Start function required between every function call.

Testing Outer Perimeter

Testing proved to be successful.

Now to work on the inside of the house.

Current Work

Hard-coding the inside squares.

Modifying supplemental ultrasonic sensor code (from ELEGOO) to work with my current code.

Download Code