Arduino and Code Section
This section shows the state machines that were implemented on Pork Barrel. In addition, the accompanying code is also provided for reference.
The pins used on the Arduino are as follows (the colors are wire colors):
TAPE_PIN_OUT1 8 // red
TAPE_PIN_OUT2 9 // white
TAPE_PIN_IN 4 // white/red
MOTOR_RIGHT_PWR 10 // black ~
MOTOR_LEFT_PWR 11 // green ~
MOTOR_LEFT_DIR 12 // red
MOTOR_RIGHT_DIR 13 // yellow -> then white to ground
IR_PIN_OUT1 5 // black
IR_PIN_OUT2 6 // white
IR_PIN_OUT3 7 // red
IR_IN 2 // interrupt - white
FRONT_BUMPER 3 // red
DIRECTION_SENSOR A0 // white
UNUSED_PIN2 1
UNUSED_PIN3 0
The pins used on the Arduino are as follows (the colors are wire colors):
TAPE_PIN_OUT1 8 // red
TAPE_PIN_OUT2 9 // white
TAPE_PIN_IN 4 // white/red
MOTOR_RIGHT_PWR 10 // black ~
MOTOR_LEFT_PWR 11 // green ~
MOTOR_LEFT_DIR 12 // red
MOTOR_RIGHT_DIR 13 // yellow -> then white to ground
IR_PIN_OUT1 5 // black
IR_PIN_OUT2 6 // white
IR_PIN_OUT3 7 // red
IR_IN 2 // interrupt - white
FRONT_BUMPER 3 // red
DIRECTION_SENSOR A0 // white
UNUSED_PIN2 1
UNUSED_PIN3 0
Brick Beating Behavior
Pork Barrel will start off by searching for an 850 Hz enemy signal. When the enemy has been discovered, Pork Barrel will turn towards them and charge. If Pork Barrel charges onto the black tape, he will reverse for a bit and then start searching for the enemy again.
Example Enemy Beating Behavior
This is an example of one of our state diagram designs to beat a moving opponent from the side.