Intel® Makers
Intel® Edison, Intel® Joule™, Intel® Curie™, Intel® Galileo
Announcements
Welcome - This is a Peer-to-Peer Forum only. Intel has discontinued these products but you may find support from other customers on this Forum
9868 Discussions

Adafruit motor shield lib sample program compilation error

Pranav_S_Intel
Employee
1,910 Views

I am trying to compile DC Motor Test sample program from Adafruit Motor Shile Library I downloaded from following link:

https://learn.adafruit.com/adafruit-motor-shield-v2-for-arduino/install-software https://learn.adafruit.com/adafruit-motor-shield-v2-for-arduino/install-software

But, getting following error message, any idea?

============================================================

Arduino: 1.5.3-Intel.1.0.4 (Windows 7), Board: "Intel® Edison"

C:\arduino-1.5.3-Intel.1.0.4/hardware/tools/edison/sysroots/i686-pokysdk-mingw32/usr/bin/i586-poky-linux/i586-poky-linux-g++ -m32 -march=i586 --sysroot=C:\arduino-1.5.3-Intel.1.0.4/hardware/tools/edison/sysroots/core2-32-poky-linux -c -g -Os -w -fno-exceptions -ffunction-sections -fdata-sections -MMD -D__ARDUINO_X86__ -march=i686 -m32 -DARDUINO=153 -IC:\arduino-1.5.3-Intel.1.0.4\hardware\arduino\edison\cores\arduino -IC:\arduino-1.5.3-Intel.1.0.4\hardware\arduino\edison\variants\edison_fab_c -IC:\arduino-1.5.3-Intel.1.0.4\hardware\arduino\edison\libraries\Wire -IC:\Users\pksangha\Documents\Arduino_Intel\libraries\Adafruit_Motorshield C:\Users\pksangha\AppData\Local\Temp\build3388182312693987287.tmp\DCMotorTest.cpp -o C:\Users\pksangha\AppData\Local\Temp\build3388182312693987287.tmp\DCMotorTest.cpp.o

Using previously compiled: C:\Users\pksangha\AppData\Local\Temp\build3388182312693987287.tmp\Wire\Wire.cpp.o

C:\arduino-1.5.3-Intel.1.0.4/hardware/tools/edison/sysroots/i686-pokysdk-mingw32/usr/bin/i586-poky-linux/i586-poky-linux-g++ -m32 -march=i586 --sysroot=C:\arduino-1.5.3-Intel.1.0.4/hardware/tools/edison/sysroots/core2-32-poky-linux -c -g -Os -w -fno-exceptions -ffunction-sections -fdata-sections -MMD -D__ARDUINO_X86__ -march=i686 -m32 -DARDUINO=153 -IC:\arduino-1.5.3-Intel.1.0.4\hardware\arduino\edison\cores\arduino -IC:\arduino-1.5.3-Intel.1.0.4\hardware\arduino\edison\variants\edison_fab_c -IC:\arduino-1.5.3-Intel.1.0.4\hardware\arduino\edison\libraries\Wire -IC:\Users\pksangha\Documents\Arduino_Intel\libraries\Adafruit_Motorshield -IC:\Users\pksangha\Documents\Arduino_Intel\libraries\Adafruit_Motorshield\utility C:\Users\pksangha\Documents\Arduino_Intel\libraries\Adafruit_Motorshield\Adafruit_MotorShield.cpp -o C:\Users\pksangha\AppData\Local\Temp\build3388182312693987287.tmp\Adafruit_Motorshield\Adafruit_Moto...

C:\Users\pksangha\Documents\Arduino_Intel\libraries\Adafruit_Motorshield\Adafruit_MotorShield.cpp: In member function 'void Adafruit_MotorShield::begin(uint16_t)':

C:\Users\pksangha\Documents\Arduino_Intel\libraries\Adafruit_Motorshield\Adafruit_MotorShield.cpp:29:15: error: 'Wire1' was not declared in this scope

# define WIRE Wire1

^

C:\Users\pksangha\Documents\Arduino_Intel\libraries\Adafruit_Motorshield\Adafruit_MotorShield.cpp:46:3: note: in expansion of macro 'WIRE'

WIRE.begin();

^

=====================================================================================================

0 Kudos
8 Replies
Carlos_M_Intel
Employee
325 Views

Hi PranavSanghadia

I downloaded the .zip from here https://github.com/adafruit/Adafruit_Motor_Shield_V2_Library adafruit/Adafruit_Motor_Shield_V2_Library · GitHub and just added the library in the IDE. For this, what I do is create a folder with all the library's files in C:\arduino-1.5.3-Intel.1.0.4\libraries after that with IDE, go to Sketch -> Import Library -> Add library and select the folder where are the files. I just did this and import a blank sketch with the libraries and I was able to "verify" the code successfully. Unfortunately I don't have the shield to test this. Remember that even if the verify goes well without errors, the library was made for Arduino boards that are different from the Edison with the Arduino Expansion Board, so it could or could not worked on the first run. If the shield doesn't respond and the verify process was good, it means that we will need to do some changes in the libraries to get it work.

Regards;

CMata

Pranav_S_Intel
Employee
325 Views

It did not solve the issue:

There is a disconnect here, please help me understand. If you download from the link you mentioned in your reply and try to import, it won't work because only basic letters are allowed in lib names. If you are able to import Adafruit_Motor_Shield_V2_Library-master.zip file without any error, looks like I am doing something wrong.

If you assumed certain things in your answer, here is what I tried further.

1) Uninstalled standard Arduino software from my computer

2) Changed Sketchbook location from File -> Preferences to C:\arduino-1.5.3-Intel.1.0.4 (this will import new libraries under C:\arduino-1.5.3-Intel.1.0.4\libraries folder)

3) I had to open zip file and rename the folder to AdafruitMotorShield to successfully import the library.

I tried the same as you, imported AdafruitMotorShield lib in a black sketch, which basically adds # include to the sketch. I got the same compilation error, Attached is screenshot. Any workaround?

.

Carlos_M_Intel
Employee
325 Views

Hi PranavSanghadia

I'm not sure why it ran the first time, now I'm having the same issue that you. But I could fixed it, what I did:

First, erase the folder of the library that you added in C:\Users\you\Documents\Arduino\libraries

In Adafruit_MotorShield.cpp and Adafruit_PWMServoDriver.cpp, you need to erase the lines:

# ifdef __AVR__

# define WIRE Wire

# else // Arduino Due

# define WIRE Wire1

# endif

Put in there:

# define WIRE Wire

This is because the library was made for Arduino boards so tries to know which board it's using.

Yes, you need to change the name of the folder, maybe AdafruitMotorlib or something else, in that folder you must have:

examples(folder), utility(folder), Adafruit_MotorShield.cpp, Adafruit_MotorShield.h, keywords.txt, license.txt and README.txt

But you need to copy the Wire.h and Wire.cpp for your edison in that folder.

Go to C:\arduino-1.5.3-Intel.1.0.4\hardware\arduino\edison\libraries\Wire and copy the files in the another one. Do not erase them from the Wire folder, just copy and paste them in the another folder in order to not affect other libraries.

Let me know if this works for you.

Regards;

CMata

Carlos_M_Intel
Employee
325 Views

Hi PranavSanghadia ;

Were you able to compile the code without errors?

Regards;

CMata

Pranav_S_Intel
Employee
325 Views

I made changes in .cpp files, but when I tried to compile DCMotorTest I got a different/following error message:

===================ERROR Message===========================

Arduino: 1.5.3-Intel.1.0.4 (Windows 7), Board: "Intel® Edison"

C:\arduino-1.5.3-Intel.1.0.4/hardware/tools/edison/sysroots/i686-pokysdk-mingw32/usr/bin/i586-poky-linux/i586-poky-linux-g++ -m32 -march=i586 --sysroot=C:\arduino-1.5.3-Intel.1.0.4/hardware/tools/edison/sysroots/core2-32-poky-linux -c -g -Os -w -fno-exceptions -ffunction-sections -fdata-sections -MMD -D__ARDUINO_X86__ -march=i686 -m32 -DARDUINO=153 -IC:\arduino-1.5.3-Intel.1.0.4\hardware\arduino\edison\cores\arduino -IC:\arduino-1.5.3-Intel.1.0.4\hardware\arduino\edison\variants\edison_fab_c -IC:\arduino-1.5.3-Intel.1.0.4\libraries\Robot_Control -IC:\arduino-1.5.3-Intel.1.0.4\libraries\AdafruitMotorShield C:\Users\pksangha\AppData\Local\Temp\build7128611871585523794.tmp\DCMotorTest.cpp -o C:\Users\pksangha\AppData\Local\Temp\build7128611871585523794.tmp\DCMotorTest.cpp.o

C:\arduino-1.5.3-Intel.1.0.4/hardware/tools/edison/sysroots/i686-pokysdk-mingw32/usr/bin/i586-poky-linux/i586-poky-linux-gcc -m32 -march=i586 --sysroot=C:\arduino-1.5.3-Intel.1.0.4/hardware/tools/edison/sysroots/core2-32-poky-linux -c -g -Os -w -ffunction-sections -fdata-sections -MMD -D__ARDUINO_X86__ -march=i686 -m32 -DARDUINO=153 -IC:\arduino-1.5.3-Intel.1.0.4\hardware\arduino\edison\cores\arduino -IC:\arduino-1.5.3-Intel.1.0.4\hardware\arduino\edison\variants\edison_fab_c -IC:\arduino-1.5.3-Intel.1.0.4\libraries\Robot_Control -IC:\arduino-1.5.3-Intel.1.0.4\libraries\AdafruitMotorShield -IC:\arduino-1.5.3-Intel.1.0.4\libraries\Robot_Control\utility C:\arduino-1.5.3-Intel.1.0.4\libraries\Robot_Control\glcdfont.c -o C:\Users\pksangha\AppData\Local\Temp\build7128611871585523794.tmp\Robot_Control\glcdfont.c.o

C:\arduino-1.5.3-Intel.1.0.4\libraries\Robot_Control\glcdfont.c:1:20: fatal error: avr/io.h: No such file or directory

# include

^

compilation terminated.

===========================================================

Carlos_M_Intel
Employee
325 Views

Hi PranavSanghadia

Where do you have the libraries located? looking at the log that you are receiving when you compile, it looks like the libraries are in C:\Users\pksangha\Documents\Arduino_Intel\libraries\Adafruit_Motorshield ....Is this right?

Is the IDE and all the folders/files in C:\Users\pksangha\Documents\Arduino_Intel ? Or are they in C:\arduino-1.5.3-Intel.1.0.4 ?. It seems to be an error while the IDE tries to get the libraries. Could you check that? I think it could be the root of the issue.

Remember that you need to add the libraries in C:\arduino-1.5.3-Intel.1.0.4\libraries or the location where you have the software and folders.

Regards;

CMata

Pranav_S_Intel
Employee
325 Views

Thank you for your reply. Everything related Edison is in C:\arduino-1.5.3-Intel.1.0.4 folder, looks like you picked up that other path from my first email.

 

OK. I was able to compile the program :-). Following three changes are required to successfully compile the program, which includes your previous suggestions and deletion of "Robot_Control" folder:

 

1) Modify File: C:\arduino-1.5.3-Intel.1.0.4\libraries\AdafruitMotorShield\utility\Adafruit_PWMServoDriver.cpp

 

# include

# include

/* # ifdef __AVR__ // Comment out

# define WIRE Wire

# else // Arduino Due

# define WIRE Wire1

# endif */

# define WIRE Wire // Add this line

 

2) Modify File: C:\arduino-1.5.3-Intel.1.0.4\libraries\AdafruitMotorShield\Adafruit_MotorShield.cpp

 

# include "Adafruit_MotorShield.h"

# include

/* # ifdef __AVR__ // Comment out

# define WIRE Wire

# else // Arduino Due

# define WIRE Wire1

# endif */

 

# define WIRE Wire // Add this line

 

3) As per this http://forums.adafruit.com/viewtopic.php?f=25&t=60486 Adafruit Forum discussion topic: I deleted "Robot_Control" folder from C:\arduino-1.5.3-Intel.1.0.4\libraries 

 

Thanks,

 

Pranav 

 

PGana
Novice
325 Views

Hello CMata_Intel,

! I am trying to interface adafruit motor shield v1.1 with intel edison board but the AVR and pic32 files are not compatible with intel. Is there any other way to use my motor shield v1.1 or is it better to use the next version v2.1 which have inbuilt i2c

Reply