Motor Shield kit v2.0 / can't get it to compile!
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- Franklin97355
- Posts: 23911
- Joined: Mon Apr 21, 2008 2:33 pm
Re: Motor Shield kit v2.0 / can't get it to compile!
Frank, when you are having a better day come back and we will somehow get your problem solved.
-
- Posts: 11
- Joined: Thu Jun 19, 2014 3:45 pm
Re: Motor Shield kit v2.0 / can't get it to compile!
Hi!
Back again on installing libraries.
Here is what I did and still no lock.
1) Got out of Ardunio
2) Uncompressed the Adafruit_Motor_Shield_V2_library.zip file
3) Here's what it had inside the Folders:
utility
examples
ReadMe
license
keyword
Adafruit_MotorShield.h
Adafruit_MotorShield.cpp
Note that inside utility file was:
license
**Adafruit_PWMServoDriver.h
**Adadfruit_PWMServoDriver.cpp
*******************************************
The error wants ** files above
Do I need to get a degree?
Thanks
Frank g.
Back again on installing libraries.
Here is what I did and still no lock.
1) Got out of Ardunio
2) Uncompressed the Adafruit_Motor_Shield_V2_library.zip file
3) Here's what it had inside the Folders:
utility
examples
ReadMe
license
keyword
Adafruit_MotorShield.h
Adafruit_MotorShield.cpp
Note that inside utility file was:
license
**Adafruit_PWMServoDriver.h
**Adadfruit_PWMServoDriver.cpp
*******************************************
The error wants ** files above
Do I need to get a degree?
Thanks
Frank g.
- Franklin97355
- Posts: 23911
- Joined: Mon Apr 21, 2008 2:33 pm
Re: Motor Shield kit v2.0 / can't get it to compile!
And where did you put them once you uncompressed them?1) Got out of Ardunio
2) Uncompressed the Adafruit_Motor_Shield_V2_library.zip file
Did you follow these instructions? https://learn.adafruit.com/adafruit-all ... -libraries
-
- Posts: 11
- Joined: Thu Jun 19, 2014 3:45 pm
Re: Motor Shield kit v2.0 / can't get it to compile!
Hi!
While back again!
I was able to run the Motor, Stepper and servo, Using StackingTest only.
However not doing so good with DCmotorTest.
The library seems to good 'But' it only compiles and that all.
Here is my liberary:
Shetchbook/ libraries/
AccelStepper_Master > a
Adafruit_MotorShield > b
inside b) AFMotor/ AFMotor_MultiStepper/ ACCel_ConstantSpeed/ Accel_MultiStepper/
DCMotorTest/ MotorParty/ SrackingTest/ StepperTest
inside AFMotor/ ACCel_ConstantSpeed/ AFMotor_MultiStepper/ MotorParty/
MotorTest/ StepperTest
inside a) AFMotor/ AFMotor_MultiStepper/ Blocking/ ConstantSpeed/ MultiStepper/
overshoot/ random
Seems like a lot and maybe that is what is wrong with it.
Thanks
Frank G.
While back again!
I was able to run the Motor, Stepper and servo, Using StackingTest only.
However not doing so good with DCmotorTest.
The library seems to good 'But' it only compiles and that all.
Here is my liberary:
Shetchbook/ libraries/
AccelStepper_Master > a
Adafruit_MotorShield > b
inside b) AFMotor/ AFMotor_MultiStepper/ ACCel_ConstantSpeed/ Accel_MultiStepper/
DCMotorTest/ MotorParty/ SrackingTest/ StepperTest
inside AFMotor/ ACCel_ConstantSpeed/ AFMotor_MultiStepper/ MotorParty/
MotorTest/ StepperTest
inside a) AFMotor/ AFMotor_MultiStepper/ Blocking/ ConstantSpeed/ MultiStepper/
overshoot/ random
Seems like a lot and maybe that is what is wrong with it.
Thanks
Frank G.
- adafruit_support_bill
- Posts: 88093
- Joined: Sat Feb 07, 2009 10:11 am
Re: Motor Shield kit v2.0 / can't get it to compile!
You don't need or want AFMotor files. That is the library for the V1 motor shield and will not work with the V2 motor shield. You want ONLY the libraries linked in the tutorial: https://learn.adafruit.com/adafruit-mot ... l-softwareinside b) AFMotor/ AFMotor_MultiStepper/ ACCel_ConstantSpeed/ Accel_MultiStepper/
DCMotorTest/ MotorParty/ SrackingTest/ StepperTest
inside AFMotor/ ACCel_ConstantSpeed/ AFMotor_MultiStepper/ MotorParty/
MotorTest/ StepperTest
inside a) AFMotor/ AFMotor_MultiStepper/ Blocking/ ConstantSpeed/ MultiStepper/
overshoot/ random
-
- Posts: 11
- Joined: Thu Jun 19, 2014 3:45 pm
Re: Motor Shield kit v2.0 / can't get it to compile!
Hi! Bill
Why can't I see my replies I sent you?
Thanks
Frank G.
Why can't I see my replies I sent you?
Thanks
Frank G.
- adafruit_support_bill
- Posts: 88093
- Joined: Sat Feb 07, 2009 10:11 am
Re: Motor Shield kit v2.0 / can't get it to compile!
Replies posted here? Can you re-post?
- chakv
- Posts: 4
- Joined: Sat Nov 15, 2014 10:11 pm
Re: Motor Shield kit v2.0 / can't get it to compile!
I am using AdafruitMotor shield V2 and unable to compile the code (see at the end below) it returned error message "AF_DCMotor does not name type".
I thought it was missing some header file and included several of them, but I think AFMotor.h could be the problem since sketch editor does not show any color ( showed black fonts) for this statement but all other include statements had orange fonts. I already down loaded Motorshield V2 library and renamed the folder so that Arduino can recognize and imported library in to sketch as suggested in Adafruit. Can you please help? Thankyou in advance.
I thought it was missing some header file and included several of them, but I think AFMotor.h could be the problem since sketch editor does not show any color ( showed black fonts) for this statement but all other include statements had orange fonts. I already down loaded Motorshield V2 library and renamed the folder so that Arduino can recognize and imported library in to sketch as suggested in Adafruit. Can you please help? Thankyou in advance.
Code: Select all
#include <AFMotor.h> // Enables the Motor library
#include <Servo.h> // Enables the Servo library
#include <Adafruit_MotorShield.h>
#include <AccelStepper.h>
#include <Wire.h>
#include "utility/Adafruit_PWMServoDriver.h"
Servo PingServo;
AF_DCMotor motor1(1); // Motor 1 is connected to the port 1 on the motor shield
AF_DCMotor motor2(2); // Motor 2 is connected to the port 2 on the motor shield
int minSafeDist = 11 ; // Minimum distance for ping sensor to know when to turn
int pingPin = A0; // Ping sensor is connected to port A0
int centerDist, leftDist, rightDist, backDist; // Define variables center, left, right and back distance
long duration, inches, cm; // Define variables for Ping sensor
void setup() {
PingServo.attach(10); // Servo is attached to pin 10 in the motor shield
PingServo.write(90); // Center the Ping sensor (puts it at 90 degrees)
motor1.setSpeed(215); // Sets the speed of the first motor at 0, the motors are turned off. 255 is the fastest setting that you are able to use, I used 215 to not push the motors too hard
motor2.setSpeed(215); // Sets the speed of the second motor At 0, the motors are turned off. 255 is the fastest setting that you are able to use, I used 215 to not push the motors too hard
Serial.begin(9600); // Enables Serial monitor for debugging purposes
Serial.println("Serial test!"); // Test the Serial communication
}
void AllStop() {
motor1.run(RELEASE); // Turns off motor 1
motor2.run(RELEASE); // Turns off motor 2
}
void AllForward() { // Makes the robot go forward
motor1.run(FORWARD); // Motor 1 goes forward
motor2.run(FORWARD); // Motor 2 goes forward
Serial.println("Going forward"); // Prints a line in the serial monitor
}
void turnRight() { // Makes the robot go right
motor2.run(BACKWARD); // Turns off motor 2
motor1.run(FORWARD); // Motor 1 goes forward
delay(1600); // Time required to turn right (1.6 seconds)
Serial.println("Motors going Right"); // Prints a line in the serial monitor
}
void GoBack(){ // Makes the robot go back
motor2.run(BACKWARD); // Motor 2 goes back
motor1.run(BACKWARD); // Motor 1 goes back
delay(1600); // Time Required to go back (1.6 seconds)
Serial.println("Backward"); // Prints a line in the serial monitor
}
void turnLeft() { // Makes the robot go Left
motor2.run(FORWARD); // Motor 2 goes forward
motor1.run(BACKWARD); // turns off motor 1
delay(1600); //Time Required to turn left (1.6)Seconds
Serial.println("Motors going Left");// Prints a line in the serial monitor
}
// Starts the loop to decide what to do
void loop()
{
LookAhead();
Serial.print(inches);
Serial.println(" inches"); // Prints a line in the serial monitor
if(inches >= minSafeDist) /* If the inches in front of an object is greater than or equal to the minimum safe distance (11 inches), react*/
{
AllForward(); // All wheels forward
delay(110); // Wait 0.11 seconds
}else // If not:
{
AllStop(); // Stop all motors
LookAround(); // Check your surroundings for best route
if(rightDist > leftDist) // If the right distance is greater than the left distance , turn right
{
turnRight();
}else if (leftDist > rightDist) // If the left distance is greater than the right distance , turn left
{
turnLeft();
}else if (leftDist&&rightDist<minSafeDist) // If the left and right distance is smaller than the min safe distance (11 inch) go back
{
GoBack();
}
}
}
unsigned long ping() {
pinMode(pingPin, OUTPUT); // Make the Pingpin to output
digitalWrite(pingPin, LOW); //Send a low pulse
delayMicroseconds(2); // wait for two microseconds
digitalWrite(pingPin, HIGH); // Send a high pulse
delayMicroseconds(5); // wait for 5 micro seconds
digitalWrite(pingPin, LOW); // send a low pulse
pinMode(pingPin,INPUT); // switch the Pingpin to input
duration = pulseIn(pingPin, HIGH); //listen for echo
/*Convert micro seconds to Inches
-------------------------------------*/
inches = microsecondsToInches(duration);
cm = microsecondsToCentimeters(duration);
}
long microsecondsToInches(long microseconds) // converts time to a distance
{
return microseconds / 74 / 2;
}
long microsecondsToCentimeters(long microseconds) // converts time to a distance
{
return microseconds / 29 / 2;
}
void LookAhead() {
PingServo.write(90);// angle to look forward
delay(175); // wait 0.175 seconds
ping();
}
void LookAround(){
PingServo.write(180); // 180° angle
delay(320); // wait 0.32 seconds
ping();
rightDist = inches; //get the right distance
PingServo.write(0); // look to the other side
delay(620); // wait 0.62 seconds
ping();
leftDist = inches; // get the left distance
PingServo.write(90); // 90° angle
delay(275); // wait 0.275 seconds
// Prints a line in the serial monitor
Serial.print("RightDist: ");
Serial.println(rightDist);
Serial.print("LeftDist: ");
Serial.println(leftDist);
Serial.print("CenterDist: ");
Serial.println(centerDist);
}
Last edited by adafruit_support_bill on Sun Nov 16, 2014 7:40 am, edited 1 time in total.
Reason: please use the </> button when submitting code. press </>, then paste your code between the [code] [/code] tags.
Reason: please use the </> button when submitting code. press </>, then paste your code between the [code] [/code] tags.
- adafruit_support_bill
- Posts: 88093
- Joined: Sat Feb 07, 2009 10:11 am
Re: Motor Shield kit v2.0 / can't get it to compile!
That error indicates that you have 2 problems:"AF_DCMotor does not name type".
1) The compier was not able to locate the AF_Motor Library.
2) The AF_Motor library is not the library you should be using.
The V2 motor shield requires the V2 motor library. You can find the library here:
https://github.com/adafruit/Adafruit_Mo ... V2_Library
And install it according to the instructions here:
http://learn.adafruit.com/adafruit-all- ... nstall-use
- chakv
- Posts: 4
- Joined: Sat Nov 15, 2014 10:11 pm
Re: Motor Shield kit v2.0 / can't get it to compile!
Still getting "AF_DCMotor does not name a type" on the 7th line of the code
As per procedure downloaded v2 motor library master and renamed " Adafruit_MotorShield". There were six example programs in that folder.
Accel_ConstantSpeed
Accel_MultiStepper
DCMotorTest
MotorParty
StackingTest
StepperTest
all of them compiled ok but not the programme pasted below
As per procedure downloaded v2 motor library master and renamed " Adafruit_MotorShield". There were six example programs in that folder.
Accel_ConstantSpeed
Accel_MultiStepper
DCMotorTest
MotorParty
StackingTest
StepperTest
all of them compiled ok but not the programme pasted below
Code: Select all
#include <Adafruit_MotorShield.h>
#include <Servo.h> // Enables the Servo library
#include <Wire.h>
#include "utility/Adafruit_PWMServoDriver.h"
Servo PingServo;
AF_DCMotor motor1(1); // Motor 1 is connected to the port 1 on the motor shield
AF_DCMotor motor2(2); // Motor 2 is connected to the port 2 on the motor shield
int minSafeDist = 11 ; // Minimum distance for ping sensor to know when to turn
int pingPin = A0; // Ping sensor is connected to port A0
int centerDist, leftDist, rightDist, backDist; // Define variables center, left, right and back distance
long duration, inches, cm; // Define variables for Ping sensor
void setup() {
PingServo.attach(10); // Servo is attached to pin 10 in the motor shield
PingServo.write(90); // Center the Ping sensor (puts it at 90 degrees)
motor1.setSpeed(215); // Sets the speed of the first motor (At 0, the motors are turned off. 255 is the fastest setting that you are able to use, I used 215 to not push the motors too hard.)
motor2.setSpeed(215); // Sets the speed of the second motor (At 0, the motors are turned off. 255 is the fastest setting that you are able to use, I used 215 to not push the motors too hard.)
Serial.begin(9600); // Enables Serial monitor for debugging purposes
Serial.println("Serial test!"); // Test the Serial communication
}
void AllStop() {
motor1.run(RELEASE); // Turns off motor 1
motor2.run(RELEASE); // Turns off motor 2
}
void AllForward() { // Makes the robot go forward
motor1.run(FORWARD); // Motor 1 goes forward
motor2.run(FORWARD); // Motor 2 goes forward
Serial.println("Going forward"); // Prints a line in the serial monitor
}
void turnRight() { // Makes the robot go right
motor2.run(BACKWARD); // Turns off motor 2
motor1.run(FORWARD); // Motor 1 goes forward
delay(1600); // Time required to turn right (1.6 seconds)
Serial.println("Motors going Right"); // Prints a line in the serial monitor
}
void GoBack(){ // Makes the robot go back
motor2.run(BACKWARD); // Motor 2 goes back
motor1.run(BACKWARD); // Motor 1 goes back
delay(1600); // Time Required to go back (1.6 seconds)
Serial.println("Backward"); // Prints a line in the serial monitor
}
void turnLeft() { // Makes the robot go Left
motor2.run(FORWARD); // Motor 2 goes forward
motor1.run(BACKWARD); // turns off motor 1
delay(1600); //Time Required to turn left (1.6)Seconds
Serial.println("Motors going Left");// Prints a line in the serial monitor
}
// Starts the loop to decide what to do
void loop()
{
LookAhead();
Serial.print(inches);
Serial.println(" inches"); // Prints a line in the serial monitor
if(inches >= minSafeDist) /* If the inches in front of an object is greater than or equal to the minimum safe distance (11 inches), react*/
{
AllForward(); // All wheels forward
delay(110); // Wait 0.11 seconds
}else // If not:
{
AllStop(); // Stop all motors
LookAround(); // Check your surroundings for best route
if(rightDist > leftDist) // If the right distance is greater than the left distance , turn right
{
turnRight();
}else if (leftDist > rightDist) // If the left distance is greater than the right distance , turn left
{
turnLeft();
}else if (leftDist&&rightDist<minSafeDist) // If the left and right distance is smaller than the min safe distance (11 inch) go back
{
GoBack();
}
}
}
unsigned long ping() {
pinMode(pingPin, OUTPUT); // Make the Pingpin to output
digitalWrite(pingPin, LOW); //Send a low pulse
delayMicroseconds(2); // wait for two microseconds
digitalWrite(pingPin, HIGH); // Send a high pulse
delayMicroseconds(5); // wait for 5 micro seconds
digitalWrite(pingPin, LOW); // send a low pulse
pinMode(pingPin,INPUT); // switch the Pingpin to input
duration = pulseIn(pingPin, HIGH); //listen for echo
/*Convert micro seconds to Inches
-------------------------------------*/
inches = microsecondsToInches(duration);
cm = microsecondsToCentimeters(duration);
}
long microsecondsToInches(long microseconds) // converts time to a distance
{
return microseconds / 74 / 2;
}
long microsecondsToCentimeters(long microseconds) // converts time to a distance
{
return microseconds / 29 / 2;
}
void LookAhead() {
PingServo.write(90);// angle to look forward
delay(175); // wait 0.175 seconds
ping();
}
void LookAround(){
PingServo.write(180); // 180° angle
delay(320); // wait 0.32 seconds
ping();
rightDist = inches; //get the right distance
PingServo.write(0); // look to the other side
delay(620); // wait 0.62 seconds
ping();
leftDist = inches; // get the left distance
PingServo.write(90); // 90° angle
delay(275); // wait 0.275 seconds
// Prints a line in the serial monitor
Serial.print("RightDist: ");
Serial.println(rightDist);
Serial.print("LeftDist: ");
Serial.println(leftDist);
Serial.print("CenterDist: ");
Serial.println(centerDist);
}
- Attachments
-
- Adafruit help please.PNG (50.5 KiB) Viewed 886 times
- adafruit_support_bill
- Posts: 88093
- Joined: Sat Feb 07, 2009 10:11 am
Re: Motor Shield kit v2.0 / can't get it to compile!
You can't use AF_DCMotor. That is from the AF_Motor library. You are using the V2 motor library for the V2 shield.Still getting "AF_DCMotor does not name a type"
The V2 library is documented here: https://learn.adafruit.com/adafruit-mot ... -reference
- chakv
- Posts: 4
- Joined: Sat Nov 15, 2014 10:11 pm
Re: Motor Shield kit v2.0 / can't get it to compile!
It took too long to understand that my code was in V1 motor shield and the hardware and the library I have is V2 motor shield, it was not clear from the replies for my post. It was great help from the link, so I tried to understand the difference then luckily I followed the code for DC motor from the example code that was part of
library. For unused code lines i added // in the beginning so compiler will ignore as comment line. In the end code did compile successfully. I pasted here, Mr Bill may please look and suggest it is ok or it needs tweak or improvement.Thanks Mr. Bill
library. For unused code lines i added // in the beginning so compiler will ignore as comment line. In the end code did compile successfully. I pasted here, Mr Bill may please look and suggest it is ok or it needs tweak or improvement.Thanks Mr. Bill
Code: Select all
#include <Adafruit_MotorShield.h>
#include <Servo.h> // Enables the Servo library
#include <Wire.h>
#include "utility/Adafruit_PWMServoDriver.h"
Servo PingServo;
Adafruit_MotorShield AFMS = Adafruit_MotorShield();
//AF_DCMotor motor1(1); // Motor 1 is connected to the port 1 on the motor shield
//AF_DCMotor motor2(2); // Motor 2 is connected to the port 2 on the motor shield
Adafruit_DCMotor *myMotor1 = AFMS.getMotor(1);
Adafruit_DCMotor *myMotor2 = AFMS.getMotor(2);
int minSafeDist = 11 ; // Minimum distance for ping sensor to know when to turn
int pingPin = A0; // Ping sensor is connected to port A0
int centerDist, leftDist, rightDist, backDist; // Define variables center, left, right and back distance
long duration, inches, cm; // Define variables for Ping sensor
void setup() {
PingServo.attach(10); // Servo is attached to pin 10 in the motor shield
PingServo.write(90); // Center the Ping sensor (puts it at 90 degrees)
//motor1.setSpeed(215); // Sets the speed of the first motor (At 0, the motors are turned off. 255 is the fastest setting that you are able to use, I used 215 to not push the motors too hard.)
//motor2.setSpeed(215); // Sets the speed of the second motor (At 0, the motors are turned off. 255 is the fastest setting that you are able to use, I used 215 to not push the motors too hard.)
Serial.begin(9600); // Enables Serial monitor for debugging purposes
Serial.println("Serial test!"); // Test the Serial communication
AFMS.begin(); // create with the default frequency 1.6KHz
myMotor1->setSpeed(215); // Sets the speed of the first motor (At 0, the motors are turned off. 255 is the fastest setting that you are able to use, I used 215 to not push the motors too hard.)
myMotor2->setSpeed(215); // Sets the speed of the second motor (At 0, the motors are turned off. 255 is the fastest setting that you are able to use, I used 215 to not push the motors too hard.)
}
void AllStop() {
//motor1.run(RELEASE); // Turns off motor 1
//motor2.run(RELEASE); // Turns off motor 2
myMotor1->run(RELEASE); // Turns off motor 1
myMotor2->run(RELEASE); // Turns off motor 2
}
void AllForward() { // Makes the robot go forward
//motor1.run(FORWARD); // Motor 1 goes forward
//motor2.run(FORWARD); // Motor 2 goes forward
myMotor1->run(FORWARD); // Motor 1 goes forward
myMotor2->run(FORWARD); // Motor 2 goes forward
Serial.println("Going forward"); // Prints a line in the serial monitor
}
void turnRight() { // Makes the robot go right
//motor2.run(BACKWARD); // Turns off motor 2
//motor1.run(FORWARD); // Motor 1 goes forward
myMotor2->run(BACKWARD); // Turns off motor 2
myMotor1->run(FORWARD); // Motor 1 goes forward
delay(1600); // Time required to turn right (1.6 seconds)
Serial.println("Motors going Right"); // Prints a line in the serial monitor
}
void GoBack(){ // Makes the robot go back
//motor2.run(BACKWARD); // Motor 2 goes back
//motor1.run(BACKWARD); // Motor 1 goes back
myMotor2->run(BACKWARD); // Motor 2 goes back
myMotor1->run(BACKWARD); // Motor 1 goes back
delay(1600); // Time Required to go back (1.6 seconds)
Serial.println("Backward"); // Prints a line in the serial monitor
}
void turnLeft() { // Makes the robot go Left
//motor2.run(FORWARD); // Motor 2 goes forward
//motor1.run(BACKWARD); // turns off motor 1
myMotor2->run(FORWARD); // Motor 2 goes forward
myMotor1->run(BACKWARD); // turns off motor 1
delay(1600); //Time Required to turn left (1.6)Seconds
Serial.println("Motors going Left");// Prints a line in the serial monitor
}
// Starts the loop to decide what to do
void loop()
{
uint8_t i;
LookAhead();
Serial.print(inches);
Serial.println(" inches"); // Prints a line in the serial monitor
if(inches >= minSafeDist) /* If the inches in front of an object is greater than or equal to the minimum safe distance (11 inches), react*/
{
AllForward(); // All wheels forward
delay(110); // Wait 0.11 seconds
}else // If not:
{
AllStop(); // Stop all motors
LookAround(); // Check your surroundings for best route
if(rightDist > leftDist) // If the right distance is greater than the left distance , turn right
{
turnRight();
}else if (leftDist > rightDist) // If the left distance is greater than the right distance , turn left
{
turnLeft();
}else if (leftDist&&rightDist<minSafeDist) // If the left and right distance is smaller than the min safe distance (11 inch) go back
{
GoBack();
}
}
}
unsigned long ping() {
pinMode(pingPin, OUTPUT); // Make the Pingpin to output
digitalWrite(pingPin, LOW); //Send a low pulse
delayMicroseconds(2); // wait for two microseconds
digitalWrite(pingPin, HIGH); // Send a high pulse
delayMicroseconds(5); // wait for 5 micro seconds
digitalWrite(pingPin, LOW); // send a low pulse
pinMode(pingPin,INPUT); // switch the Pingpin to input
duration = pulseIn(pingPin, HIGH); //listen for echo
/*Convert micro seconds to Inches
-------------------------------------*/
inches = microsecondsToInches(duration);
cm = microsecondsToCentimeters(duration);
}
long microsecondsToInches(long microseconds) // converts time to a distance
{
return microseconds / 74 / 2;
}
long microsecondsToCentimeters(long microseconds) // converts time to a distance
{
return microseconds / 29 / 2;
}
void LookAhead() {
PingServo.write(90);// angle to look forward
delay(175); // wait 0.175 seconds
ping();
}
void LookAround(){
PingServo.write(180); // 180° angle
delay(320); // wait 0.32 seconds
ping();
rightDist = inches; //get the right distance
PingServo.write(0); // look to the other side
delay(620); // wait 0.62 seconds
ping();
leftDist = inches; // get the left distance
PingServo.write(90); // 90° angle
delay(275); // wait 0.275 seconds
// Prints a line in the serial monitor
Serial.print("RightDist: ");
Serial.println(rightDist);
Serial.print("LeftDist: ");
Serial.println(leftDist);
Serial.print("CenterDist: ");
Serial.println(centerDist);
}
- adafruit_support_bill
- Posts: 88093
- Joined: Sat Feb 07, 2009 10:11 am
Re: Motor Shield kit v2.0 / can't get it to compile!
Those changes look correct. Do the motors run as expected?
- chakv
- Posts: 4
- Joined: Sat Nov 15, 2014 10:11 pm
Re: Motor Shield kit v2.0 / can't get it to compile!
Yet to upload the code in to Arduino and try. I will keep you posted.
Thanks,
Chakv
Thanks,
Chakv
Please be positive and constructive with your questions and comments.