chipKIT® Development Platform

Inspired by Arduino™

Adding libraries to the IDE?

Created Tue, 16 Oct 2012 04:10:46 +0000 by hrh1818


hrh1818

Tue, 16 Oct 2012 04:10:46 +0000

I would like to add 2 libraries to the IDE. The libraries are TextFinder and Afmotor. With Arduino all you need to do is copy the library to Arduino's libraries folder and restart the IDE. But this doesn't work with the Chiokit IDE.

How do you add libraries to the Chipkit IDE?

Howard


lloyddean

Tue, 16 Oct 2012 04:30:53 +0000

The same way


majenko

Tue, 16 Oct 2012 10:48:53 +0000

Place libraries in the hardware/pic32/libraries folder so they get picked up by the pic32 compiler.


hrh1818

Tue, 16 Oct 2012 17:39:16 +0000

Thank you for your reply.

I put AFMotor.h and TextFinder.h in the hardware/pic32/libraries folder. The pic32 compiler finds AFMotor.h but not TextFinder.h. The pic32 compiler produces this error message.

In file included from sketch_oct16a.cpp:1:0: C:\Documents and Settings\Howard\My Documents
Uno32\mpide-0023-windows-20120903.\hardware
pic32\libraries\TextFinder/TextFinder.h:31:21: fatal error: Arduino.h: No such file or directory compilation terminated.

I double checked the spelling. and location of TextFinder.h. Both are correct.

Any advice on why the pic32 compiler can't find TextFinder.h

hrh1818


EmbeddedMan

Tue, 16 Oct 2012 19:02:19 +0000

It think the error message is telling you that it can't find Arduino.h that's included from AFMotor.h.

It sounds like TextFinder may be set up for Arduino 1.0. It will likely have to be smomewhat tweaked to work for MPIDE.

*Brian


hrh1818

Tue, 16 Oct 2012 20:32:58 +0000

Your comment. "It think the error message is telling you that it can't find Arduino.h that's included from AFMotor.h." Sorry, I am looking for a better explanation. My test case had one line. #include <TextFinder.h>. How could AFMotor.h cause an error when it is not included in the test case?

Your comment. "It sounds like TextFinder may be set up for Arduino 1.0. It will likely have to be some what tweaked to work for MPIDE." This doesn't sound plausible. The TextFinder SendReceive example works with versions 0023, 1.0 and 1.01 of Arduino. Besides the error message says "no such file or directory". It doesn't say anything about faulty code.

hrh1818


JordanR

Tue, 16 Oct 2012 21:01:15 +0000

Hello hrh1818

The error that you posted actually shows that MPIDE is finding TextFinder.h. It just can't find Arduino.h, which is included in TextFinder.h. I believe you need to have Arduino.h within the folder TextFinder (where you have the library saved in libraries).

The reason that it doesn't say anything about faulty code is because the compilier quites at the "fatal error" of being unable to find an included header file. What Brian is suggesting (I believe) is that once you find Arduino.h and the compilier gets past the #include statements, there will likely be other issues.

Best Regards,

Jordan R


BloodyCactus

Tue, 16 Oct 2012 21:02:40 +0000

look inside textfinder.h and see what "#include" calls it has.

it includes Arduino.h, so it will need to be modified.

your dropping header files in, are you also dropping in the code to go with those header files?


EmbeddedMan

Tue, 16 Oct 2012 21:05:34 +0000

Sorry, you are right on your first point because I was thinking one thing and typed another.

My comment should have said "It think the error message is telling you that it can't find Arduino.h that's included from TextFinder.h."

The reason is because MPIDE doesn't have an Arduino.h - that was added in Arduino 1.0, which we don't support (yet). So the code must be placed in Arduino 0023 mode, however that's done for that piece of code.

And for my second comment, I stand by that. There is nothing wrong with the code (in that it works on Arduino platforms), it may be that it's just not set up (yet) to work with MPIDE. Some libraries need different amounts of tweaking to work properly under MPIDE - many do not need any. Some need complete re-writes. Yours may need something inbetween. It entirely depends upon how the library author wrote the library.

*Brian


hrh1818

Tue, 16 Oct 2012 23:16:03 +0000

Thank you for your patience. It is obvious I don't know how to interpret MPIDE error messages.

I found these lines in TextFinder.h

#if ARDUINO <= 22 #include "WProgram.h" #else // for Arduino 1.0 #include <Arduino.h> #include <inttypes.h> #endif

By changing the first line to #if ARDUINO <= 23 the Textfinder SendReceive example compiles with out any errors.

However, when I upload the TextFinder example, the up loading process hangs. The progress bar stops at about 75% completion. Quitting and retrying doesn't help. As the next time I try to upload, MPIDE says the COM port is in use. It is necessary to restart my computer to try again.

Any advice on what is causing the up loading to hang and what to do to fix the problem.

hrh1818


hrh1818

Tue, 16 Oct 2012 23:26:00 +0000

Update

Even a simple sketch like Blink hangs during the up loading process.

hrh1818


JordanR

Tue, 16 Oct 2012 23:33:01 +0000

Hello hrh1818,

Have you used MPLAB with you chipKIT board (thus, erasing the bootloader needed to communicate with MPIDE)? This is the most common reason I have seen for this error.

If this is the case, you will need to reburn the bootloader on to the board. If this is not the case... we will try something different!

Although, reading your post again, you mentioned that

It is necessary to restart my computer to try again.

So this solves the issue? Does it work more than once?

Best Regards,

Jordan R


hrh1818

Wed, 17 Oct 2012 00:07:25 +0000

No, restarting my computer doesn't solve my problem. Restarting my computer allows me to repeat the problem. Other wise if just quit MPIDE and try again, MPIDE tells me the Uno32 COM port is in use.

hrh1818


hrh1818

Wed, 17 Oct 2012 00:14:11 +0000

This the first time I have used this Uno32 and I have only used it with the Chipkit version of the Arduino IDE.

What else should I try?

hrh1818


JordanR

Wed, 17 Oct 2012 00:28:03 +0000

Hello hrh1818,

Make sure that when you plug the Uno32 into the computer, a new COM port shows up in the Device Manager. And, when you unplug it, that COM port disappears. Make sure that that COM port is not actually already in use. If you plugged it in and let it install drivers on it's own, an available COM port should have been used.

Best Regards,

Jordan R


hrh1818

Wed, 17 Oct 2012 03:19:01 +0000

Yes when I connect the USB cable a new COM port appears and disappears when I unplug the USB cable. I also removed the USBser.sys driver and let Windows install a driver when I connected the USB cable. This did not help.

hrh1818


hrh1818

Wed, 17 Oct 2012 04:23:47 +0000

Hold the phones. Everything is working perfectly

I thank all who help me.

hrh18918


ajitnayak

Wed, 21 Nov 2012 13:14:59 +0000

is it possible to add arduino lib to chipkit library

how can utilse those liberary