Problem with Programming Servos Using Adafruit 16-Channel Servo Shield

Hi
I just started using this Adafruit servo shield but was having problems with my code. I somewhat understand how to control the servos using the Adafruit Servo Driver library, but the code you see here was taken from a youtube video. I changed the MIN_PULSE_WIDTH and MAX_PULSE_WIDTH to fit my servos and then changed the two pwm.setPWM() commands that have “original commands” commented next to them so that they would manipulate the servo attached to pin 6 and rotate it the amount i wanted. After compiling and uploading that code(the two other pwm.setPWM() commands weren’t in the original code), the servos did exactly what is shown, rotating from 160 degrees to 90 degrees and back every two seconds. I then added the two other pwm.setPWM() commands but came up with this error:

Please submit a full bug report,

with preprocessed source if appropriate.

See http://gcc.gnu.org/bugs.html for instructions.

lto-wrapper.exe: fatal error: C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.21.0_x86__mdqgnx93n4wtt\hardware\tools\avr/bin/avr-gcc returned 1 exit status

compilation terminated.

c:/program files/windowsapps/arduinollc.arduinoide_1.8.21.0_x86__mdqgnx93n4wtt/hardware/tools/avr/bin/…/lib/gcc/avr/5.4.0/…/…/…/…/avr/bin/ld.exe: error: lto-wrapper failed

collect2.exe: error: ld returned 1 exit status

exit status 1
Error compiling for board Arduino/Genuino Uno.

I then deleted one of the commands I added and successfully compiled my program. I undeleted that command and deleted the other one. This two compiled correctly. Is there something I am missing? In the video they do the same thing as I do, copy and paste the pwm.setPWM() commands and change the values to control different servos, so I know it is possible to control the servos in the way I want to with these commands.

Thanks.

#include <Wire.h>
#include <Adafruit_PWMServoDriver.h>

Adafruit_PWMServoDriver pwm = Adafruit_PWMServoDriver();

#define MIN_PULSE_WIDTH       350
#define MAX_PULSE_WIDTH       2200
#define DEFAULT_PULSE_WIDTH   1500
#define FREQUENCY             50

void setup() {
  pwm.begin();
  pwm.setPWMFreq(FREQUENCY);
}

void loop() {
  pwm.setPWM(6, 0, pulseWidth(160)); // original commands
  pwm.setPWM(5, 0, pulseWidth(50));
  delay(1000);
  pwm.setPWM(6, 0, pulseWidth(90)); // original commands
  pwm.setPWM(5, 0, pulseWidth(180)); //problem line
  delay(1000);
}

int pulseWidth(int angle)
{
  int pulse_wide, analog_value;
  pulse_wide   = map(angle, 0, 180, MIN_PULSE_WIDTH, MAX_PULSE_WIDTH);
  analog_value = int(float(pulse_wide) / 1000000 * FREQUENCY * 4096);
  return analog_value;
}

Compiler bug.

  • Tools -> Board: -> Boards Manager...
  • At the top of the list you should find "Arduino AVR Boards Built--In by Arduino version 1.6.23 INSTALLED".
  • Hover your mouse cursor over that.
  • Select 1.6.22 from the Select Version menu.
  • Click on the "Install" button.

johnwasser:
Compiler bug.

  • Tools -> Board: -> Boards Manager...
  • At the top of the list you should find "Arduino AVR Boards Built--In by Arduino version 1.6.23 INSTALLED".
  • Hover your mouse cursor over that.
  • Select 1.6.22 from the Select Version menu.
  • Click on the "Install" button.

Thankyou!!