@Anno I didn't modify the code. My teacher did (I think he had no idea what he was doing). So anyways, I asked around, and people told me to use the newping library. So I followed the instructions and I came up with the following, but it won't work. What did I do wrong?
#include <NewPing.h>
#define SensorN 2
#define max_dis 5
#define PING_INTERVAL 33
const int motor=9;
volatile int average_dis=0;
unsigned long pingTimer[SensorN];
unsigned int cm[SensorN];
uint8_t currentSensor = 0;
NewPing sonar[SensorN] = {
#include <NewPing.h>
#define SensorN 2
#define max_dis 5
#define PING_INTERVAL 33
const int motor=9;
volatile int average_dis=0;
unsigned long pingTimer[SensorN];
unsigned int cm[SensorN];
uint8_t currentSensor = 0;
NewPing sonar[SensorN] = {