Electronic – arduino – How to import a library into a Arduino program

arduinoprocessingprogramming

I have a Arduino program wich make use of the processing library.

The program code starts with

import processing.serial.*;

When I try to compile it with the Arduino compiler it crashes with

'import' does not name a file

The code I want to execute is http://www.instructables.com/id/Controlling-an-RGB-Led-with-Arduino-and-Processing/

I pasted the serial library folder from processing into the same folder as my code. But it still crashes.


Update:
My assumptions were wrong! The code I tried to use was designed for Java and to be used with the Processing IDE not the Arduino IDE. It works fine now with Processing! And the other part of the code works fine with the Arduino IDE 🙂

Best Answer

Your code looks like you are using Java. Or are you using the Arduino IDE.

import processing.serial.*;

looks like Java code. If you are using the Arduino IDE it won't accept that command.

To import a library in C, the command is #include.