0

ADAFRUIT MOTOR SHIED NEW LIBRARY PRPBLEM
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

ADAFRUIT MOTOR SHIED NEW LIBRARY PRPBLEM

by kpurzycki on Thu Nov 08, 2018 2:53 pm



I have been using for 3 years an Arduino Uno V3 with a Adafruit Motor Shield V2.3 to control a HiTech HS-785HB servo using microseconds see below . Everything worked great. I wanted to add a new function and upon compiling I received 3 pages of errors which for all practical purposes could have ne written in Greek.
#include <Wire.h>
#include <Adafruit_MCP23017.h> //Adafruit LCD library
#include <Adafruit_RGBLCDShield.h> //Adafruit DIS[LAYLibrary
#include <Servo.h> //Aduino servo library servo1 uses pin 9 Servo2 uses pin 10
#include <Adafruit_MotorShield.h> //Adafruit Motor Shield ver 2.3
#include "utility/Adafruit_PWMServoDriver.h" //
// Create the motor shield object with the default I2C address
Adafruit_MotorShield AFMS = Adafruit_MotorShield();
Adafruit_DCMotor *Motor1 = AFMS.getMotor(1); //"*" needed Pump fill Motor
Adafruit_DCMotor *Motor2 = AFMS.getMotor(2); //"*" needed Pump empty Motor
//adjust M_S2 to get 3 in travel (M_S> higher MS2 < lower)
int M_S1=460; //hitech servo 1 travel 255 microseconds
int M_S2=360; //hiteck servo2 deflection 360
int Bar_set1= 1600; //hitecch servo starting point 1375 microsecond
int Bar_set2 = 1575 ; //start point for servo2 bar (rack down)
Servo myservo1; //rack hitech785HB servo Pin 10 open close rack thid servo does 2.5 rotations not the std 180 degrees
Servo myservo2; //rack hitech785HB servo Pin 9 lift & Drop rack
Adafruit_RGBLCDShield lcd = Adafruit_RGBLCDShield();
#define ON 0x1 // = RED // set aDAFRUIT RGB display to white on blue 5
int P = 0; // ESC BUTTON ON ADAFRUIT RGB dISPLAY

I since found that the Library for the shield has been modified and the code as written does not seem to accept using Microsecond to control the 32.5 revolution Hitech servo .

I was able to set a starting point at 1500ms and then move it to + or minus what ever distance I needed
Ex move to the left myservo2.writeMicroseconds(Bar_set2 - M_S2);
Ex move to the Right myservo2.writeMicroseconds(Bar_set2+= M_S2);

It looks like "utility/Adafruit_PWMServoDriver.h" //was rewriten ?????
Does anyone know when the libraries were rewritten??
I would appreciate any help I can get to get the new Adafruit motor shield libraries to control a servo.
Please write a simple sketch which will move a single servo using the new library code .
I need a simple place to start

Thanks in advance

kpurzycki
 
Posts: 78
Joined: Mon Jan 13, 2014 11:46 am

Re: ADAFRUIT MOTOR SHIED NEW LIBRARY PRPBLEM

by adafruit_support_bill on Thu Nov 08, 2018 3:15 pm

On the V2.3 motor shield, servos are controlled using the standard Arduino Servo library on pins 9 and/or 10. The Adafruit_PWMServoDriver library is used only for PWM control of DC or stepper motors.

Please post the code that you are using and the full text of the error messages you are getting.

adafruit_support_bill
 
Posts: 70027
Joined: Sat Feb 07, 2009 10:11 am

Re: ADAFRUIT MOTOR SHIED NEW LIBRARY PRPBLEM

by kpurzycki on Mon Nov 12, 2018 12:11 pm

HI thanks for the response. I tried a lot of things since your response but nothing worked. Finally I retrieved the original sketch I did for using the Hitech HS785HB servo. I stripped it of everything except the basic to control a servo using microseconds and only Servo.h I attached a copy as hs785 basic 11-11-18.doc This sketch verified and uploaded without any errors. in fact I made some ms changes to make sure I could get the linear deflection I needed. I played with this sketch for an hour or so until I got the attached 22 page error statement, I tried to reboot everything and verify the sketch again and received the same error message. I have no idea what the error message is trying to tell me . I can not verify or up load the sketch.
If I power up the Arduino Uno it runs the sketch without errors,
I even checked under windows 10 device manager that Com4 is working properly. I also tried reloading the latest com driver nothing worked.
Can you review the 20 page error doc and maybe detect what the hell is going on
Thank you in advance.

kpurzycki
 
Posts: 78
Joined: Mon Jan 13, 2014 11:46 am

Re: ADAFRUIT MOTOR SHIED NEW LIBRARY PRPBLEM

by adafruit_support_bill on Mon Nov 12, 2018 12:13 pm

Please post the code that you are using and the full text of the error messages you are getting.

adafruit_support_bill
 
Posts: 70027
Joined: Sat Feb 07, 2009 10:11 am

Re: ADAFRUIT MOTOR SHIED NEW LIBRARY PRPBLEM

by kpurzycki on Tue Nov 13, 2018 2:26 pm

HI
I was just about to get rid of all Arduino files and reload a new Arduino file when I discovered I had several Documents/Arduino files on my c: drive. I also found that there were several preferences. The last line should contain the following c:/myname/documents/Arduino!!!

How do I edit that last line? I attached a JPG of the Preferences screen The top arrow is correct the lower one is not. I want the k
lower one to be the same as the upper one.

any suggestions would be tried
Thanks
Ken.
Attachments
preferences  11-13-18.jpg
preferences 11-13-18.jpg (106.13 KiB) Viewed 18 times

kpurzycki
 
Posts: 78
Joined: Mon Jan 13, 2014 11:46 am

Re: ADAFRUIT MOTOR SHIED NEW LIBRARY PRPBLEM

by adafruit_support_bill on Tue Nov 13, 2018 3:00 pm

I don't know of any way of directly editing that. How did you end up with that path?

You might try deleting your current install and re-installing the IDE.

adafruit_support_bill
 
Posts: 70027
Joined: Sat Feb 07, 2009 10:11 am

Re: ADAFRUIT MOTOR SHIED NEW LIBRARY PRPBLEM

by kpurzycki on Tue Nov 13, 2018 3:56 pm

Do you know if Arduino has an uninstall method?? That normally would remove all associated files which will easily let me reinstall the newest Arduino download?

I looks like when ever download a new Arduino download or update happened over the years it sets up a new Preferences file. I have at least 5 in different areas on my C dive and on the my Microsoft Onedrive
The error messages iv been getting seem to be do the date of the sketch and which library it was using. This is usually set up in the Preferences file.
Just so I don't screw things up worst. I always thought that sketches, libraries were by default saved in C;/user/ name/ documents/Arduino;. I plan to erase Arduino reference files preferences eth except those associated with C:/user/my name/ documents/Arduino;
I will then check for the presence of any Arduino related file or library or prefence..

I will then down load the latest Aduino update and check to make sure the preference.txt file is set up correctly.

Have you ever tried to up date the files associated with the Preferences.txt file?? there are about 3 pages of commands which control the performance of Arduino.

Thanks again for you informative reponse.
Ken

kpurzycki
 
Posts: 78
Joined: Mon Jan 13, 2014 11:46 am

Re: ADAFRUIT MOTOR SHIED NEW LIBRARY PRPBLEM

by adafruit_support_bill on Tue Nov 13, 2018 4:09 pm

If you used the Windows installer, you can uninstall via the Control Panel. Otherwise, you just delete the install folder.

I'm not sure how the Arduino IDE decides where to locate the preferences file. Sounds like it might be related to where you install it from.
The best place to ask IDE install questions is on the Arduino forum: https://forum.arduino.cc/

adafruit_support_bill
 
Posts: 70027
Joined: Sat Feb 07, 2009 10:11 am

Please be positive and constructive with your questions and comments.