final project  1
drive.c File Reference

control the robot's movement and direction More...

#include "main.h"

Go to the source code of this file.

Functions

void turn_right (oi_t *sensor, int degrees)
 Turns the robot right. More...
 
void turn_left (oi_t *sensor, int degrees)
 Turns the robot left. More...
 
short move_back (oi_t *sensor, short cm)
 Moves the robot back. More...
 
short move_forward (oi_t *sensor, short cm)
 Moves the robot forward. More...
 
void stopmoving ()
 Stops robot from moving. More...
 

Variables

short speed = 150
 
short turnSpeed = 150
 
float turnScalar = 5
 
float distScalar = 2.5
 
char sumData [3]
 
float sum = 0
 
short ret = 0
 
char bumpL = 0
 
char bumpR = 0
 

Detailed Description

control the robot's movement and direction

also detects bumper sensors and calls the ground detect sensors

Author
Steven, Kynara, Saba, Bailey, Brett, Austin
Date
4/24/18

Definition in file drive.c.

Function Documentation

◆ move_back()

short move_back ( oi_t sensor,
short  cm 
)

Moves the robot back.

Moves the robot back cm number of centimeters

Parameters
sensoris a pointer to the open interface sensor. cm is the number of centimeters the robot must move back

Definition at line 67 of file drive.c.

◆ move_forward()

short move_forward ( oi_t sensor,
short  cm 
)

Moves the robot forward.

Moves the robot forward cm number of centimeters

Parameters
sensoris a pointer to the open interface sensor. cm is the number of centimeters the robot must move forward

Definition at line 84 of file drive.c.

◆ stopmoving()

void stopmoving ( )

Stops robot from moving.

Stops robot from moving (changes speed of wheels to 0)

Definition at line 132 of file drive.c.

◆ turn_left()

void turn_left ( oi_t sensor,
int  degrees 
)

Turns the robot left.

Turns the robot left degrees number of degrees

Parameters
sensoris a pointer to the open interface sensor. degrees is the number of degrees the robot must turn left.

Definition at line 49 of file drive.c.

◆ turn_right()

void turn_right ( oi_t sensor,
int  degrees 
)

Turns the robot right.

Turns the robot right degrees number of degrees

Parameters
sensoris a pointer to the open interface sensor. degrees is the number of degrees the robot must turn right.

Definition at line 32 of file drive.c.