0

Adafruit Motor Shield v2 library examples won't compile
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Adafruit Motor Shield v2 library examples won't compile

by tedkurtz on Tue Jun 20, 2017 1:28 pm

Hello,

I just downloaded the Arduino motor-shield library. When I attempt to compile the DCMotorTest example in the library, I get "Error compiling" with the following:

Arduino: 1.0.6 (Windows 7), Board: "Arduino Uno"
C:\Program Files (x86)\Arduino\hardware\tools\avr\bin\avr-g++ -c -g -Os -Wall -fno-exceptions -ffunction-sections -fdata-sections -mmcu=atmega328p -DF_CPU=16000000L -MMD -DUSB_VID=null -DUSB_PID=null -DARDUINO=106 -IC:\Program Files (x86)\Arduino\hardware\arduino\cores\arduino -IC:\Program Files (x86)\Arduino\hardware\arduino\variants\standard -IC:\Program Files (x86)\Arduino\libraries\Wire -IC:\Program Files (x86)\Arduino\libraries\Adafruit_Motor_Shield_V2_Library-master C:\Users\owner\AppData\Local\Temp\build9070234571449194604.tmp\AdafruitMotorShield_Two_Motors_Test_20June2017.cpp -o C:\Users\owner\AppData\Local\Temp\build9070234571449194604.tmp\AdafruitMotorShield_Two_Motors_Test_20June2017.cpp.o

C:\Program Files (x86)\Arduino\hardware\tools\avr\bin\avr-g++ -c -g -Os -Wall -fno-exceptions -ffunction-sections -fdata-sections -mmcu=atmega328p -DF_CPU=16000000L -MMD -DUSB_VID=null -DUSB_PID=null -DARDUINO=106 -IC:\Program Files (x86)\Arduino\hardware\arduino\cores\arduino -IC:\Program Files (x86)\Arduino\hardware\arduino\variants\standard -IC:\Program Files (x86)\Arduino\libraries\Wire -IC:\Program Files (x86)\Arduino\libraries\Adafruit_Motor_Shield_V2_Library-master -IC:\Program Files (x86)\Arduino\libraries\Wire\utility C:\Program Files (x86)\Arduino\libraries\Wire\Wire.cpp -o C:\Users\owner\AppData\Local\Temp\build9070234571449194604.tmp\Wire\Wire.cpp.o

C:\Program Files (x86)\Arduino\hardware\tools\avr\bin\avr-gcc -c -g -Os -Wall -ffunction-sections -fdata-sections -mmcu=atmega328p -DF_CPU=16000000L -MMD -DUSB_VID=null -DUSB_PID=null -DARDUINO=106 -IC:\Program Files (x86)\Arduino\hardware\arduino\cores\arduino -IC:\Program Files (x86)\Arduino\hardware\arduino\variants\standard -IC:\Program Files (x86)\Arduino\libraries\Wire -IC:\Program Files (x86)\Arduino\libraries\Adafruit_Motor_Shield_V2_Library-master -IC:\Program Files (x86)\Arduino\libraries\Wire\utility C:\Program Files (x86)\Arduino\libraries\Wire\utility\twi.c -o C:\Users\owner\AppData\Local\Temp\build9070234571449194604.tmp\Wire\utility\twi.c.o

C:\Program Files (x86)\Arduino\hardware\tools\avr\bin\avr-g++ -c -g -Os -Wall -fno-exceptions -ffunction-sections -fdata-sections -mmcu=atmega328p -DF_CPU=16000000L -MMD -DUSB_VID=null -DUSB_PID=null -DARDUINO=106 -IC:\Program Files (x86)\Arduino\hardware\arduino\cores\arduino -IC:\Program Files (x86)\Arduino\hardware\arduino\variants\standard -IC:\Program Files (x86)\Arduino\libraries\Wire -IC:\Program Files (x86)\Arduino\libraries\Adafruit_Motor_Shield_V2_Library-master -IC:\Program Files (x86)\Arduino\libraries\Adafruit_Motor_Shield_V2_Library-master\utility C:\Program Files (x86)\Arduino\libraries\Adafruit_Motor_Shield_V2_Library-master\Adafruit_MotorShield.cpp -o C:\Users\owner\AppData\Local\Temp\build9070234571449194604.tmp\Adafruit_Motor_Shield_V2_Library-master\Adafruit_MotorShield.cpp.o

C:\Program Files (x86)\Arduino\libraries\Adafruit_Motor_Shield_V2_Library-master\Adafruit_MotorShield.cpp: In member function 'void Adafruit_StepperMotor::step(uint16_t, uint8_t, uint8_t)':
C:\Program Files (x86)\Arduino\libraries\Adafruit_Motor_Shield_V2_Library-master\Adafruit_MotorShield.cpp:237: error: 'yield' was not declared in this scope
C:\Program Files (x86)\Arduino\libraries\Adafruit_Motor_Shield_V2_Library-master\Adafruit_MotorShield.cpp: In member function 'uint8_t Adafruit_StepperMotor::onestep(uint8_t, uint8_t)':
C:\Program Files (x86)\Arduino\libraries\Adafruit_Motor_Shield_V2_Library-master\Adafruit_MotorShield.cpp:242: warning: unused variable 'a'
C:\Program Files (x86)\Arduino\libraries\Adafruit_Motor_Shield_V2_Library-master\Adafruit_MotorShield.cpp:242: warning: unused variable 'b'
C:\Program Files (x86)\Arduino\libraries\Adafruit_Motor_Shield_V2_Library-master\Adafruit_MotorShield.cpp:242: warning: unused variable 'c'
C:\Program Files (x86)\Arduino\libraries\Adafruit_Motor_Shield_V2_Library-master\Adafruit_MotorShield.cpp:242: warning: unused variable 'd'

Can you help me?

Thank you.

Ted

tedkurtz
 
Posts: 2
Joined: Tue Jun 20, 2017 1:15 pm

Re: Adafruit Motor Shield v2 library examples won't compile

by adafruit_support_bill on Tue Jun 20, 2017 1:33 pm

Looks like you are using a rather old version of the IDE (1.0.6). There have been many changes to support some of the newer Arduino processors. You will probably have better results compiling with a more recent version of the IDE. The current version is 1.8.3.
https://www.arduino.cc/en/Main/Software

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

Re: Adafruit Motor Shield v2 library examples won't compile

by Franklin97355 on Tue Jun 20, 2017 5:37 pm

You are compiling for the avr Uno while Yield() is for the SAM chips.

Franklin97355
 
Posts: 22747
Joined: Mon Apr 21, 2008 2:33 pm
Location: Lacomb, OR.

Re: Adafruit Motor Shield v2 library examples won't compile

by tedkurtz on Tue Jun 27, 2017 1:22 pm

Sorry to have been slow to reply. I've been busy; I tried updating to the latest version of the Arduino IDE as you suggested, but then I ran into a lot of other problems. For example, I use the SD library and its examples gave me compilation problems. Googling around with the error messages brings up stuff about others having similar problems. I had no problems with your library a month or so ago. I've been working on something else recently. Going back last week, the file which previously compiled no longer does. I have no idea about what is wrong now, but wonder if it has anything to do with modifications to the IDE.

I'm going back to the earlier version of the IDE and use the Arduino motor-controller shield. That works for me.

Thank you.

Ted

tedkurtz
 
Posts: 2
Joined: Tue Jun 20, 2017 1:15 pm

Re: Adafruit Motor Shield v2 library examples won't compile

by adafruit_support_bill on Tue Jun 27, 2017 2:57 pm

You can also try going to line 237 of the library .cpp file and comment out the call to "yield()". This was recently added to support one of the newer processors and is not relevant for most Arduinos.

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

Please be positive and constructive with your questions and comments.