Go Down

Topic: Problem uploading to Uno and Mega 2560 Board (Read 105 times) previous topic - next topic

r123k

I am very new in Arduino, enjoying an Uno (already spoiled another Uno) and an Mega2560. I tried to run a stepper motor and two dc motor with Mega 2560 and Arduino Shield Board. I wrote a code with the help of other codes available in internet.

the code is OK but while trying  uploading in Mega the last line comes as,
"exit status 1
Error compiling for board Arduino/Genuino Mega or Mega 2560."


I tried uploadding from a laptop with Windows10 and with another with Ubuntu 17.04.
In both the cases result is same.
I want help from experts for completing.
The complete reports from the computer is attatched below.
Thanks and Regards,
Rana Khan.

---------------******----------------******---------------*************--------------*********

Compiling libraries...
Compiling library "Stepper"
Using previously compiled file: /tmp/arduino_build_486833/libraries/Stepper/Stepper.cpp.o
Compiling library "Adafruit_Motor_Shield_library"
Using previously compiled file: /tmp/arduino_build_486833/libraries/Adafruit_Motor_Shield_library/AFMotor.cpp.o
Compiling library "Adafruit_Motor_Shield_V2_Library"
Using previously compiled file: /tmp/arduino_build_486833/libraries/Adafruit_Motor_Shield_V2_Library/Adafruit_MotorShield.cpp.o
Using previously compiled file: /tmp/arduino_build_486833/libraries/Adafruit_Motor_Shield_V2_Library/utility/Adafruit_MS_PWMServoDriver.cpp.o
Compiling library "Wire"
Using previously compiled file: /tmp/arduino_build_486833/libraries/Wire/Wire.cpp.o
Using previously compiled file: /tmp/arduino_build_486833/libraries/Wire/utility/twi.c.o
Compiling library "PWMServo"
Using previously compiled file: /tmp/arduino_build_486833/libraries/PWMServo/PWMServo.cpp.o
Compiling library "Button"
Using previously compiled file: /tmp/arduino_build_486833/libraries/Button/Button.cpp.o
Compiling core...
Using previously compiled file: /tmp/arduino_build_486833/core/wiring_pulse.S.o
Using previously compiled file: /tmp/arduino_build_486833/core/WInterrupts.c.o
Using previously compiled file: /tmp/arduino_build_486833/core/hooks.c.o
Using previously compiled file: /tmp/arduino_build_486833/core/wiring.c.o
Using previously compiled file: /tmp/arduino_build_486833/core/wiring_pulse.c.o
Using previously compiled file: /tmp/arduino_build_486833/core/wiring_analog.c.o
Using previously compiled file: /tmp/arduino_build_486833/core/wiring_shift.c.o
Using previously compiled file: /tmp/arduino_build_486833/core/wiring_digital.c.o
Using previously compiled file: /tmp/arduino_build_486833/core/CDC.cpp.o
Using previously compiled file: /tmp/arduino_build_486833/core/HardwareSerial.cpp.o
Using previously compiled file: /tmp/arduino_build_486833/core/HardwareSerial0.cpp.o
Using previously compiled file: /tmp/arduino_build_486833/core/HardwareSerial1.cpp.o
Using previously compiled file: /tmp/arduino_build_486833/core/HardwareSerial2.cpp.o
Using previously compiled file: /tmp/arduino_build_486833/core/HardwareSerial3.cpp.o
Using previously compiled file: /tmp/arduino_build_486833/core/IPAddress.cpp.o
Using previously compiled file: /tmp/arduino_build_486833/core/PluggableUSB.cpp.o
Using previously compiled file: /tmp/arduino_build_486833/core/Print.cpp.o
Using previously compiled file: /tmp/arduino_build_486833/core/WString.cpp.o
Using previously compiled file: /tmp/arduino_build_486833/core/Tone.cpp.o
Using previously compiled file: /tmp/arduino_build_486833/core/USBCore.cpp.o
Using previously compiled file: /tmp/arduino_build_486833/core/WMath.cpp.o
Using previously compiled file: /tmp/arduino_build_486833/core/main.cpp.o
Using previously compiled file: /tmp/arduino_build_486833/core/abi.cpp.o
Using previously compiled file: /tmp/arduino_build_486833/core/new.cpp.o
Using previously compiled file: /tmp/arduino_build_486833/core/Stream.cpp.o
Using previously compiled file: /tmp/arduino_build_486833/core/core.a
Archiving built core (caching) in: /tmp/arduino_cache_27005/core/core_arduino_avr_mega_cpu_atmega2560_af1bdde207d6b3fbd1572c44677e2228.a
Linking everything together...
/home/rana/arduino-1.8.7/hardware/tools/avr/bin/avr-gcc -Os -g -flto -fuse-linker-plugin -Wl,--gc-sections,--relax -mmcu=atmega2560 -o /tmp/arduino_build_486833/sketch_sep21a.ino.elf /tmp/arduino_build_486833/sketch/sketch_sep21a.ino.cpp.o /tmp/arduino_build_486833/libraries/Stepper/Stepper.cpp.o /tmp/arduino_build_486833/libraries/Adafruit_Motor_Shield_library/AFMotor.cpp.o /tmp/arduino_build_486833/libraries/Adafruit_Motor_Shield_V2_Library/Adafruit_MotorShield.cpp.o /tmp/arduino_build_486833/libraries/Adafruit_Motor_Shield_V2_Library/utility/Adafruit_MS_PWMServoDriver.cpp.o /tmp/arduino_build_486833/libraries/Wire/Wire.cpp.o /tmp/arduino_build_486833/libraries/Wire/utility/twi.c.o /tmp/arduino_build_486833/libraries/PWMServo/PWMServo.cpp.o /tmp/arduino_build_486833/libraries/Button/Button.cpp.o /tmp/arduino_build_486833/core/core.a -L/tmp/arduino_build_486833 -lm
/tmp/arduino_build_486833/libraries/Adafruit_Motor_Shield_V2_Library/Adafruit_MotorShield.cpp.o (symbol from plugin): In function `Adafruit_MotorShield::begin(unsigned int, TwoWire*)':
(.text+0x0): multiple definition of `microstepcurve'
/tmp/arduino_build_486833/libraries/Adafruit_Motor_Shield_library/AFMotor.cpp.o (symbol from plugin):(.text+0x0): first defined here
/home/rana/arduino-1.8.7/hardware/tools/avr/bin/../lib/gcc/avr/5.4.0/../../../../avr/bin/ld: Disabling relaxation: it will not work with multiple definitions
collect2: error: ld returned 1 exit status
Using library Stepper at version 1.1.3 in folder: /home/rana/arduino-1.8.7/libraries/Stepper
Using library Adafruit_Motor_Shield_library at version 1.0.0 in folder: /home/rana/Arduino/libraries/Adafruit_Motor_Shield_library
Using library Adafruit_Motor_Shield_V2_Library at version 1.0.5 in folder: /home/rana/Arduino/libraries/Adafruit_Motor_Shield_V2_Library
Using library Wire at version 1.0 in folder: /home/rana/arduino-1.8.7/hardware/arduino/avr/libraries/Wire
Using library PWMServo at version 2.1 in folder: /home/rana/Arduino/libraries/PWMServo
Using library Button at version 1.0.0 in folder: /home/rana/Arduino/libraries/Button
exit status 1
Error compiling for board Arduino/Genuino Mega or Mega 2560.

DrAzzy

#1
Sep 22, 2018, 08:44 am Last Edit: Sep 22, 2018, 08:44 am by DrAzzy
multiple definition of `microstepcurve' is the issue.

It looks like you're including two adafruit motor shield libraries (Adafruit_Motor_Shield_V2_Library and Adafruit_Motor_Shield_library) - these are probably not compatible. Of course, you haven't posted your code, so we're working with a blindfold on....
ATtiny core for 841+1634+828 and x313/x4/x5/x61/x7/x8 series Board Manager:
http://drazzy.com/package_drazzy.com_index.json
ATtiny breakouts (some assembled), mosfets and awesome prototyping board in my store http://tindie.com/stores/DrAzzy

r123k

Dear DrAzzy,
I am very happy that you pointed out the correction solution, the code was uploaded. Many Many Thanks to you.
But here is another problem with the code in smaller version.
I am using this code for driving a stepper (200 steps), 2 dc (max 10 rpm) which will be my DIY Telescope Drive, Stepper for RA axis motion, one DC for Declination control and DC for Focus control,
So I wrote this code for testing the motors.

#include <Stepper.h>
#include <AFMotor.h>
#include <PWMServo.h>
 
#define SSpeed 1
#define StepePerRevol 200

AF_Stepper RA(StepePerRevol, 2);
AF_DCMotor Dec1(1,MOTOR12_8KHZ);
AF_DCMotor Focus2(2,MOTOR12_8KHZ);

void setup(){
  Dec1.setSpeed(200);
  Focus2.setSpeed(200);
  RA.setSpeed(SSpeed);
}

void loop(){
    ra();
    decl();
    focus();
}

void ra(){
    RA.setSpeed(SSpeed);
    RA.step(StepePerRevol, FORWARD, MICROSTEP);
}

void decl(){
Dec1.run(FORWARD);
}

void focus(){
Focus2.run(FORWARD);
}

with this code the stepper motor runs smartly at once, but two DC start rolling after 3 minutes !!!!??

with some modification of the code, things become more complicated,


include <Stepper.h>
#include <AFMotor.h>
#include <PWMServo.h>
#include <Button.h>
#include <Wire.h>
 

#define SSpeed 1
#define StepePerRevol 200
int command;
int redLEDpin = 32;
int greenLEDpin = 33;
int speakerPin = 34; 
boolean meridianFlip = false;

AF_Stepper RA(StepePerRevol, 2);
AF_DCMotor Dec1(1,MOTOR12_8KHZ);
AF_DCMotor Focus2(2,MOTOR12_8KHZ);

Button West = Button(22); // The Buttons will be used later on, after adding in the circuit,
Button East = Button(24); // now just in the code
Button DecN = Button(26);
Button DecS = Button(28);
Button FocusIn = Button(30);
Button FocusOut = Button(31);
Button SlewSpd = Button(32);


void setup(){
  Dec1.setSpeed(200);
  Focus2.setSpeed(200);
  RA.setSpeed(SSpeed);
  Serial.begin(57600);
  Serial.print("INITIALISED#"); 
  pinMode(redLEDpin, OUTPUT);
  pinMode(greenLEDpin, OUTPUT);
  pinMode(speakerPin, OUTPUT);
       }

void loop(){
    ra();
    decl();
    focus();
  void speedchk();
  void readserial();
}   
   
   
  void ra(){
    RA.setSpeed(SSpeed);
    RA.step(StepePerRevol, FORWARD, MICROSTEP);
    if(West.pressed()){
  RA.setSpeed(SSpeed*10);
  RA.step(StepePerRevol, FORWARD, MICROSTEP);
  }
  if (West.pressed() && SlewSpd.pressed()){
  RA.setSpeed(SSpeed*20);
  RA.step(StepePerRevol, FORWARD, MICROSTEP);
  tone(speakerPin, 7040, 20);
  }
  if (East.pressed()){
  RA.setSpeed(SSpeed*10);
  RA.step(StepePerRevol, FORWARD, MICROSTEP);
  }
  if (East.pressed() && SlewSpd.pressed()){
  RA.setSpeed(SSpeed*20);
  RA.step(StepePerRevol, FORWARD, MICROSTEP);
  tone(speakerPin, 7040, 20);
  }
  else {
    RA.setSpeed(SSpeed);
    RA.step(StepePerRevol, FORWARD, MICROSTEP);
    }
  }
 void decl(){Dec1.run(FORWARD);
  if (DecN.pressed()){
    Dec1.run(FORWARD);}
  else if (DecS.pressed()){
    Dec1.run(BACKWARD);}
  else {Dec1.run(RELEASE);
    }
 }

 void focus(){Focus2.run(FORWARD);
 if(FocusIn.pressed()){
    Focus2.run(FORWARD);}
  else if(FocusOut.pressed()){
    Focus2.run(BACKWARD);}
  else {Focus2.run(RELEASE);
    }
    }

 

The stepper goes moving on and on without fail, but the DC starts late as earlier case, declination motor Dec1, stops in some time after takes long rest, then starts moving in opposite direction.
The Focus2, stops for ever after moving  some rotation. Actually in real time those two DC motor will move only under Button Press, in ATmega2560 with Arduino Motor Shield it seems me difficult,

Thanks and regards,
Rana.


Go Up