Arduino libraries help

I’m trying to upload a library to arduino from the Carduino instructable http://www.instructables.com/id/Carduin … /?ALLSTEPS

I downloaded the zip file and imported the library, but when I put it in the sketch it only shows the .h file and gives me the error message:

core.a(main.cpp.o): In function `main’:

C:\Program Files (x86)\Arduino\hardware\arduino\cores\ard… undefined reference to `setup’

C:\Program Files (x86)\Arduino\hardware\arduino\cores\ard… undefined reference to `loop’

The four “example” files show up in the sketchbook, but each opens in a new window. They individually verify, but when copy/pasting them together I get error messages.

I can’t seem to import the .cpp file at all, and when I try to drag and drop it I get the same error message.

I’m on a Win7 PC and I just d/l’ed and saved the ZIP file to my Downloads folder. It has some odd F4IJ6J1H27LSA96.zip name. No matter, I just followed the Automatic Installation instructions at the link below and the library files were installed just fine next time I started the Arduini IDE (1.0.5). Have you tried that ? It’s the 1’st time the auto-install worked for me but work it did and an example sketch verified/compiled.

http://arduino.cc/en/Guide/Libraries#.Uy8RgoUVBrA

They installed fine and they’re all there, but the .h file doesn’t compile

katanahikari:
They installed fine and they’re all there, but the .h file doesn’t compile

??? Huh ???

Why don’t you post a screenshot of the error messages you’re now getting (or copy’n’paste them into a text file and post that) along with the code you’re trying to run.

Wait so when I plug in the arduino to upload the code what do I upload? Do I upload the .h file, just one sketch example, upload multiple sketch examples individually or copy/paste all the sketch examples into one?

Okay I think I figured this out. My problem is I need to combine four sketches. Can anyone help me do that?

Why don’t you post what you want to do … in your own words. Do you have any prior experience writing code for the Arduino (or other platform) ? Perhaps you should read the Arduino fundamentals pages.

http://arduino.cc/en/Tutorial/Foundations#.Uy9VbYUVBrA

http://arduino.cc/en/Tutorial/Sketch#.Uy9Vf4UVBrA

http://arduino.cc/en/Reference/Setup#.Uy9VoYUVBrA

http://arduino.cc/en/Reference/Loop#.Uy9Vt4UVBrA

http://arduino.cc/en/Tutorial/HomePage#.Uy9V14UVBrA

To use the functions (or methods as I think they are properly called) that a library provides, you “include” the library by placing a #include <library-name.h> statement near the top of your sketch. In your case …

#include <Carduino.h>

You then invoke an instance of the library and give it a name. The example code used …

Carduino mycarduino;

… but you can use any name you want in place of mycarduino, like …

Carduino carbot;

… in which case you’d use this to initialize the code in the setup() region.

carbot.begin();

… instead of the example’s …

mycarduino.begin();

Those library functions would be :

begin(); (do this in setup() to initialize the code for the functions below)

goforward(float seconds, int speed);

goback(float seconds, int speed);

turnright(int time);

turnleft(int time);

proximity();

You use the function needed to make the bot do what you want it to do. Some functions require some added info (aka arguments) in order for them to do their job. Looking at the examples coding is probably the best way to learn the library functions and what arguments they need.