Help me

Good evening friends, recently a friend of mine wanted to teach me a little about arduino, plus it just disappearing, only giving me a code for me to learn, where even bought a kit by following his instructions, because the project was part of a tcc I'm developing on automated systems. If someone could help me with the links, because I have the material compatible with the project because I'm not much of programming. Follow the code below.

Include <NewPing.h>

Define TRIGGER_PIN 47

Define ECHO_PIN_RIGHT 53

Define ECHO_PIN_CENTER 51

Define ECHO_PIN_LEFT 49

Define MAX_DISTANCE 300

NewPing sonarRight (TRIGGER_PIN, ECHO_PIN_RIGHT, MAX_DISTANCE);
NewPing sonarCenter (TRIGGER_PIN, ECHO_PIN_CENTER, MAX_DISTANCE);
NewPing sonarLeft (TRIGGER_PIN, ECHO_PIN_LEFT, MAX_DISTANCE);
rangeRight int = 0;
rangeCenter int = 0;
rangeLeft int = 0;
rangeLedRight int = 52;
rangeLedCenter int = 50;
rangeLedLeft int = 48;
creepLed int = 46;
minDistanceSide int = 35;
prefDistanceSide int = 50;
minDistanceFront int = 40;
prefDistanceFront int = 100;
long previousMillis = 0;
long sensorInterval = 50;
sensorCycle int = 0;
/ / - ENGINE -
ENA int = 5 / / Connected to Arudino Pin 5 (pwm)
int IN1 = 2, / / ??Connected to Pin 2 Arudino
IN2 int = 3; / / Connected to Pin 3 Arudino
/ / - MOTOR B -
int IN3 = 4 / / Connected to Pin 4 Arudino
int IN4 = 7 / / Connected to Pin 7 Arudino
ENB int = 6 / / Arudino Connected to Pin 6 (pwm)
creepSpeed ??int = 140;
void setup ()
{
/ / Serial.begin (9600);
pinMode (ENA, OUTPUT);
pinMode (ENB, OUTPUT);
pinMode (IN1, OUTPUT);
pinMode (IN2, OUTPUT);
pinMode (IN3, OUTPUT);
pinMode (IN4, OUTPUT);
stopMotors ();
pinMode (rangeLedRight, OUTPUT);
pinMode (rangeLedCenter, OUTPUT);
pinMode (rangeLedLeft, OUTPUT);
pinMode (creepLed, OUTPUT);
rangeSweep () / / Do a full sweep distance without moving
}
void loop ()
{
unsigned long currentMillis = millis ();
if (currentMillis - previousMillis> sensorInterval)
{
previousMillis = currentMillis;
findRange ();
}
if (minDistanceSide <= rangeRight && minDistanceSide <= rangeLeft && minDistanceFront <= rangeCenter)
{
driveForward ();
}
else if (minDistanceSide> = rangeRight prefDistanceSide && <= rangeLeft)
{
turnLeft ();
}
else if (prefDistanceSide <= rangeRight minDistanceSide &&> = rangeLeft)
{
turnright ();
}
else
{
Turnaround ();
}
}
findRange void ()
{
if (sensorCycle == 0) / / can not poll all 3 sensors at the same time, interferance issues, Thus spaced 50ms apart
{
rangeLeft sonarLeft.ping_cm = ();
sensorCycle + +;
}
else if (sensorCycle == 1)
{
rangeCenter sonarCenter.ping_cm = ();
sensorCycle + +;
}
else if (sensorCycle> = 2) / / should be impossible for it to reach 3, but hey
{
rangeRight sonarRight.ping_cm = ();
sensorCycle = 0;
}
/ / "0" is no signal, means 3m +, lowest distance it can measure is 2cm
if (rangeLeft == 0)
rangeLeft = 300;
if (rangeRight == 0)
rangeRight = 300;
if (rangeCenter == 0)
rangeCenter = 300;
if (minDistanceSide> = rangeLeft)
digitalWrite (rangeLedLeft, HIGH);
else
digitalWrite (rangeLedLeft, LOW);
if (minDistanceFront> = rangeCenter)
digitalWrite (rangeLedCenter, HIGH);
else
digitalWrite (rangeLedCenter, LOW);
if (minDistanceSide> = rangeRight)
digitalWrite (rangeLedRight, HIGH);
else
digitalWrite (rangeLedRight, LOW);
/ / Serial.print ("L");
/ / Serial.print (rangeLeft);
/ / Serial.print ("C");
/ / Serial.print (rangeCenter);
/ / Serial.print ("R");
/ / Serial.println (rangeRight);
}
rangeSweep void () / / Do a full sweep distance without moving
{
delay (50);
findRange ();
delay (50);
findRange ();
delay (50);
findRange ();
delay (50);
}
driveForward void ()
{

motorsForward ();
speedPot int = analogRead (0) / 4;
if (200 <= speedPot)
speedPot = 255;
else if (50> = speedPot)
speedPot = 0;
/ / Deadzones to Overcome math errors, robot motors do not move too at low engine speed anyway
if (prefDistanceFront <= rangeCenter && prefDistanceSide <= rangeLeft && prefDistanceSide <= rangeRight && creepSpeed> = speedPot)
{
analogWrite (ENA, speedPot);
analogWrite (ENB, speedPot);
digitalWrite (creepLed, LOW);
}
else / / Reduce speed if something is detected nearby
{
analogWrite (ENA, creepSpeed);
analogWrite (ENB, creepSpeed);
digitalWrite (creepLed, HIGH);
}
}
turnLeft void ()
{
stopMotors ();
delay (500);
motorsTurnLeft ();
runMotors ();
delay (500);
stopMotors ();
delay (500);
/ / Bought the compass module, will replace current delays with compass comparison When it arrives
rangeSweep ();
}
turnright void ()
{
stopMotors ();
delay (500);
motorsTurnRight ();
runMotors ();
delay (500);
stopMotors ();
delay (500);
/ / Bought the compass module, will replace current delays with compass comparison When it arrives
rangeSweep ();
}
Turnaround void ()
{
stopMotors ();
delay (500);

if (rangeLeft> = rangeRight)
motorsTurnLeft ();
else
motorsTurnRight ();

runMotors ();
delay (1000);
stopMotors ();
delay (500);
/ / Bought the compass module, will replace the current delays with compass comparison When It arrives
rangeSweep ();
}
stopMotors void ()
{
digitalWrite (ENA, LOW);
digitalWrite (ENB, LOW);
}
runMotors void ()
{
digitalWrite (ENA, HIGH);
digitalWrite (ENB, HIGH);
}
motorsForward void ()
{
digitalWrite (IN1, HIGH);
digitalWrite (IN2, LOW);
digitalWrite (IN3, LOW);
digitalWrite (IN4, HIGH);
}
motorsBackward void ()
{
digitalWrite (IN1, LOW);
digitalWrite (IN2, HIGH);
digitalWrite (IN3, HIGH);
digitalWrite (IN4, LOW);
}
motorsTurnLeft void ()
{
digitalWrite (IN1, HIGH);
digitalWrite (IN2, LOW);
digitalWrite (IN3, HIGH);
digitalWrite (IN4, LOW);
}
motorsTurnRight void ()
{
digitalWrite (IN1, LOW);
digitalWrite (IN2, HIGH);
digitalWrite (IN3, LOW);
digitalWrite (IN4, HIGH);
}

I believe this code invloves the use of sonar sensors for getting data about distance and applying it to cause a servo to move as directed.

and a compass it seems

Read this before posting a programming question

Code tags. "Help me" is not a useful subject line. Everyone wants help.

He's right, and be sure to make a title that will grab the attention of those who are willing to help that have knowlege about what you need help with.