Avoidance robot error message

Hello all,

I am trying to make an avoidance robot and have already built the robot using a standard chassy kit from ebay and an Arduino Uno micro controller. I have already loaded the sketch, bridge, ping and adafruit libraries to the IDE libraries and get the following error message when trying to upload to the controller. Any help is very much appreciated. Thanks.

Arduino: 1.8.1 (Windows 7), Board: "Arduino/Genuino Uno"

In file included from C:\Users\Robert\Documents\Arduino\Avoidance_Robot\Avoidance_Robot.ino:11:0:

C:\Program Files (x86)\Arduino\libraries\Servo\src/Servo.h:80:0: warning: "MAX_SERVOS" redefined

define MAX_SERVOS (_Nbr_16timers * SERVOS_PER_TIMER)

^

In file included from C:\Program Files (x86)\Arduino\libraries\Adafruit_CircuitPlayground/utility/CP_Firmata.h:17:0,

from C:\Program Files (x86)\Arduino\libraries\Adafruit_CircuitPlayground/Adafruit_CircuitPlayground.h:23,

from C:\Users\Robert\Documents\Arduino\Avoidance_Robot\Avoidance_Robot.ino:1:

C:\Program Files (x86)\Arduino\libraries\Adafruit_CircuitPlayground/utility/CP_Boards.h:32:0: note: this is the location of the previous definition

define MAX_SERVOS 0

^

C:\Program Files (x86)\Arduino\libraries\Adafruit_CircuitPlayground\utility\Adafruit_CPlay_Mic.cpp: In member function 'int Adafruit_CPlay_Mic::peak(uint16_t)':

C:\Program Files (x86)\Arduino\libraries\Adafruit_CircuitPlayground\utility\Adafruit_CPlay_Mic.cpp:27:37: error: 'analogPinToChannel' was not declared in this scope

channel = analogPinToChannel(4); // Pin A4 to ADC channel

^

C:\Program Files (x86)\Arduino\libraries\Adafruit_CircuitPlayground\utility\Adafruit_CPlay_Mic.cpp: In member function 'void Adafruit_CPlay_Mic::capture(int16_t*, uint8_t)':

C:\Program Files (x86)\Arduino\libraries\Adafruit_CircuitPlayground\utility\Adafruit_CPlay_Mic.cpp:84:37: error: 'analogPinToChannel' was not declared in this scope

channel = analogPinToChannel(4); // Pin A4 to ADC channel

^

exit status 1 Error compiling for board Arduino/Genuino Uno. Invalid library found in C:\Users\Robert\Documents\Arduino\libraries\adafruit-Adafruit-Motor-Shield-library-99381df: C:\Users\Robert\Documents\Arduino\libraries\adafruit-Adafruit-Motor-Shield-library-99381df Invalid library found in C:\Users\Robert\Documents\Arduino\libraries\adafruit-Adafruit-Motor-Shield-library-99381df: C:\Users\Robert\Documents\Arduino\libraries\adafruit-Adafruit-Motor-Shield-library-99381df

This report would have more information with "Show verbose output during compilation" option enabled in File -> Preferences.

get the following error message when trying to upload to the controller.

Upload what to the Arduino? WHERE IS YOUR CODE?

You also need to post links to all of the libraries you are using. It is not clear why you need all of them. Firmata and intelligent use of the Arduino and mutually exclusive.

Sorry, these are the links and code:

https://bitbucket.org/teckel12/arduino-new-ping/wiki/Home#!download-install

#include <Adafruit_CircuitPlayground.h>

#include <AFMotor.h>
#include <NewPing.h>

#include <NewPing.h>

#include <Adafruit_CircuitPlayground.h>

#include <AFMotor.h>
#include <Servo.h>
#include <NewPing.h>

#define TRIG_PIN A4
#define ECHO_PIN A5
#define MAX_DISTANCE_POSSIBLE 1000
#define MAX_SPEED 150 //
#define MOTORS_CALIBRATION_OFFSET 3
#define COLL_DIST 20
#define TURN_DIST COLL_DIST+10
NewPing sonar(TRIG_PIN, ECHO_PIN, MAX_DISTANCE_POSSIBLE);

AF_DCMotor leftMotor(1, MOTOR12_8KHZ);
AF_DCMotor rightMotor(2, MOTOR12_8KHZ);
Servo neckControllerServoMotor;

int pos = 0;
int maxDist = 0;
int maxAngle = 0;
int maxRight = 0;
int maxLeft = 0;
int maxFront = 0;
int course = 0;
int curDist = 0;
String motorSet = “”;
int speedSet = 0;

void setup() {
neckControllerServoMotor.attach(10);
neckControllerServoMotor.write(90);
delay(2000);
checkPath();
motorSet = “FORWARD”;
neckControllerServoMotor.write(90);
moveForward();
}

void loop() {
checkForward();
checkPath();
}

void checkPath() {
int curLeft = 0;
int curFront = 0;
int curRight = 0;
int curDist = 0;
neckControllerServoMotor.write(144);
delay(120);
for (pos = 144; pos >= 36; pos -= 18)
{
neckControllerServoMotor.write(pos);
delay(90);
checkForward();
curDist = readPing();
if (curDist < COLL_DIST) {
checkCourse();
break;
}
if (curDist < TURN_DIST) {
changePath();
}
if (curDist > curDist) {
maxAngle = pos;
}
if (pos > 90 && curDist > curLeft) {
curLeft = curDist;
}
if (pos == 90 && curDist > curFront) {
curFront = curDist;
}
if (pos < 90 && curDist > curRight) {
curRight = curDist;
}
}
maxLeft = curLeft;
maxRight = curRight;
maxFront = curFront;
}

void setCourse() {
if (maxAngle < 90) {
turnRight();
}
if (maxAngle > 90) {
turnLeft();
}
maxLeft = 0;
maxRight = 0;
maxFront = 0;
}

void checkCourse() {
moveBackward();
delay(500);
moveStop();
setCourse();
}

void changePath() {
if (pos < 90) {
lookLeft();
}
if (pos > 90) {
lookRight();
}
}

int readPing() {
delay(70);
unsigned int uS = sonar.ping();
int cm = uS / US_ROUNDTRIP_CM;
return cm;
}

void checkForward() {
if (motorSet == “FORWARD”) {
leftMotor.run(FORWARD);
rightMotor.run(FORWARD);
}
}

void checkBackward() {
if (motorSet == “BACKWARD”) {
leftMotor.run(BACKWARD);
rightMotor.run(BACKWARD);
}
}

void moveStop() {
leftMotor.run(RELEASE);
rightMotor.run(RELEASE);
}

void moveForward() {
motorSet = “FORWARD”;
leftMotor.run(FORWARD);
rightMotor.run(FORWARD);
for (speedSet = 0; speedSet < MAX_SPEED; speedSet += 2)
{
leftMotor.setSpeed(speedSet + MOTORS_CALIBRATION_OFFSET);
rightMotor.setSpeed(speedSet);
delay(5);
}
}

void moveBackward() {
motorSet = “BACKWARD”;
leftMotor.run(BACKWARD);
rightMotor.run(BACKWARD);
for (speedSet = 0; speedSet < MAX_SPEED; speedSet += 2)
{
leftMotor.setSpeed(speedSet + MOTORS_CALIBRATION_OFFSET);
rightMotor.setSpeed(speedSet);
delay(5);
}
}

void turnRight() {
motorSet = “RIGHT”;
leftMotor.run(FORWARD);
rightMotor.run(BACKWARD);
delay(400);
motorSet = “FORWARD”;
leftMotor.run(FORWARD);
rightMotor.run(FORWARD);
}

void turnLeft() {
motorSet = “LEFT”;
leftMotor.run(BACKWARD);
rightMotor.run(FORWARD);
delay(400);
motorSet = “FORWARD”;
leftMotor.run(FORWARD);
rightMotor.run(FORWARD);
}

void lookRight() {
rightMotor.run(BACKWARD);
delay(400);
rightMotor.run(FORWARD);
}
void lookLeft() {
leftMotor.run(BACKWARD);
delay(400);
leftMotor.run(FORWARD);
}

You did not post a link to the Adafruit_CircuitPlayground library. When I compile your code, I get an error because I don't have that library. When I comment out both attempts to include that file, I get only one error message:

Sketch uses 10,050 bytes (35%) of program storage space. Maximum is 28,672 bytes. Global variables use 278 bytes (10%) of dynamic memory, leaving 2,282 bytes for local variables. Maximum is 2,560 bytes.

sorry, this is the link

sorry, this is the link

1) There are 8 entries listed on that page - 2 directories and 6 files. None of the files is named Adafruit_CircuitPlayground.h or Adafruit_CircuitPlayground.cpp.

2) The page says:

This library is old and deprecated - and the hardware disconinued years ago.

Now, I don't know what "disconinued" means, but I assume it means that some one can't spell.

Do you have obsolete hardware?

Where IS the Adafruit_CircuitPlayground library? Why do you think you need it, since you don't use anything from the library in the sketch?