Importing a header file in the Arduino IDE

How do I do that?

#include "ColorWave.h" doesn't work.

I tried ColorWave r(1023, 0, 0.5); and ColorWave::ColorWave r(1023, 0, 0.5);

It works fine in Xcode, but in the Arduino IDE I get :
ShiftBrites_pde.cpp:7:23: error: ColorWave.h: No such file or directory
ShiftBrites_pde.cpp: In function 'void loop()':
ShiftBrites_pde:160: error: 'ColorWave' has not been declared
ShiftBrites_pde:160: error: expected ;' before 'r' ShiftBrites_pde:161: error: 'ColorWave' has not been declared ShiftBrites_pde:161: error: expected ;' before 'g'
ShiftBrites_pde:162: error: 'ColorWave' has not been declared
ShiftBrites_pde:162: error: expected `;' before 'b'
ShiftBrites_pde:181: error: 'r' was not declared in this scope
ShiftBrites_pde:181: error: 'g' was not declared in this scope
ShiftBrites_pde:181: error: 'b' was not declared in this scope

Thanks

Where is "ColorWave.h" ? Is it in the same folder with your sketch or in libraries folder?

The notation "ColorWave.h" means library is in the same folder with sketch.
The notation <ColorWave.h> means library is in the Arduino environment libraries folder.

I hope this helps.

It's in the same folder... I copied it across many folders to make sure. It still won't take it.

I even tried making a new tab and copying the whole header file and class in that tab but it still doesn't work.

Yet in Xcode 4 all worked very well. I had no problem using the class.

Perhaps you need to show us what is in ColorWave.h, then, along with your sketch.

You'll notice that the message you posted said nothing about not being able to include the header file, so, apparently, that is not the problem.

It is the problem, since the compiler acts like it's not there.
Also I edited my first post.

http://pastebin.com/MpN1f4xX
There is the whole class.
It works A1 in xcode so the class isn't the problem.

Sketch : http://pastebin.com/sh6jZdKM

It is the problem, since the compiler acts like it's not there.

If the compiler can not open the header file, it will tell you that is no uncertain terms. Since you did not show any message that clearly indicates that the header file can not opened, we must assume that the compiler WAS able to open the file.

Edit: Oops, failed to go back and re-read your first post.

I copied the code at that link, opened the IDE, creating a new sketch. I created a new tab, ColorWave.h, and posted the code there.

In the sketch tab, I put this:

#include "ColorWave.h"

ColorWave cw(3, 0.0, 0.5);

void setup()
{
}

void loop()
{
}

Verify showed:

Binary sketch size: 1700 bytes (of a 30720 byte maximum)

Okay so how do I get it to include it without doing that tab thing?

And the tab thing doesn't work here anyway...

It works in a new project but not in the current one.
I couldn't create ColorWave.h in the current project.

java.io.IOException: createNewFile() returned false
	at processing.app.Sketch.nameCode(Sketch.java:527)
	at processing.app.EditorStatus$3.keyTyped(EditorStatus.java:314)
	at java.awt.AWTEventMulticaster.keyTyped(AWTEventMulticaster.java:223)
	at java.awt.Component.processKeyEvent(Component.java:6328)
	at javax.swing.JComponent.processKeyEvent(JComponent.java:2801)
	at java.awt.Component.processEvent(Component.java:6150)
	at java.awt.Container.processEvent(Container.java:2085)
	at java.awt.Component.dispatchEventImpl(Component.java:4735)
	at java.awt.Container.dispatchEventImpl(Container.java:2143)
	at java.awt.Component.dispatchEvent(Component.java:4565)
	at java.awt.KeyboardFocusManager.redispatchEvent(KeyboardFocusManager.java:1850)
	at java.awt.DefaultKeyboardFocusManager.dispatchKeyEvent(DefaultKeyboardFocusManager.java:712)
	at java.awt.DefaultKeyboardFocusManager.preDispatchKeyEvent(DefaultKeyboardFocusManager.java:990)
	at java.awt.DefaultKeyboardFocusManager.typeAheadAssertions(DefaultKeyboardFocusManager.java:855)
	at java.awt.DefaultKeyboardFocusManager.dispatchEvent(DefaultKeyboardFocusManager.java:676)
	at java.awt.Component.dispatchEventImpl(Component.java:4607)
	at java.awt.Container.dispatchEventImpl(Container.java:2143)
	at java.awt.Window.dispatchEventImpl(Window.java:2478)
	at java.awt.Component.dispatchEvent(Component.java:4565)
	at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:679)
	at java.awt.EventQueue.access$000(EventQueue.java:85)
	at java.awt.EventQueue$1.run(EventQueue.java:638)
	at java.awt.EventQueue$1.run(EventQueue.java:636)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
	at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:98)
	at java.awt.EventQueue$2.run(EventQueue.java:652)
	at java.awt.EventQueue$2.run(EventQueue.java:650)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:649)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:296)
	at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:211)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:201)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:196)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:188)
	at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)

Probably because the file already exists.

Ok so I closed and reopened the project and reopened it and it works! :slight_smile:

Thanks for your help.

Ok so I closed and reopened the project and reopened it and it works

I was going to suggest the Microsoft solution, but I guess you don't need that, now.