2

I have followed the instructions to run the Arduino processing examples but with no success.

Always import processing.serial.*; does not name a type. Which is perhaps a library (processing-arduino) related error.

My sketch is a sketch that comes with processing-arduino library.

I have searched for a long time with no solution. Any suggestion?

Errors:

arduino_output:28: error: 'import' does not name a type
arduino_output:30: error: 'import' does not name a type
arduino_output:32: error: 'Arduino' does not name a type
arduino_output:34: error: 'color' does not name a type
arduino_output:35: error: 'color' does not name a type
arduino_output:37: error: expected unqualified-id before '[' token
arduino_output.pde: In function 'void setup()':
arduino_output:42: error: 'size' was not declared in this scope
arduino_output:45: error: 'Arduino' was not declared in this scope
arduino_output:45: error: 'println' was not declared in this scope
arduino_output:50: error: 'arduino' was not declared in this scope
arduino_output:50: error: expected type-specifier before 'Arduino'
arduino_output:50: error: expected `;' before 'Arduino'
arduino_output:58: error: expected unqualified-id before numeric constant
arduino_output.pde: In function 'void draw()':
arduino_output:62: error: 'off' was not declared in this scope
arduino_output:62: error: 'background' was not declared in this scope
arduino_output:63: error: 'on' was not declared in this scope
arduino_output:63: error: 'stroke' was not declared in this scope
arduino_output:66: error: 'values' was not declared in this scope
arduino_output:66: error: 'Arduino' was not declared in this scope
arduino_output:66: error: expected unqualified-id before numeric constant
arduino_output:66: error: expected `)' before numeric constant
arduino_output:67: error: 'fill' was not declared in this scope
arduino_output:69: error: 'fill' was not declared in this scope
arduino_output:71: error: 'rect' was not declared in this scope
arduino_output.pde: In function 'void mousePressed()':
arduino_output:77: error: 'mouseX' was not declared in this scope
arduino_output:80: error: 'values' was not declared in this scope
arduino_output:80: error: 'Arduino' was not declared in this scope
arduino_output:80: error: expected unqualified-id before numeric constant
arduino_output:80: error: expected `)' before numeric constant
arduino_output:81: error: 'arduino' was not declared in this scope
arduino_output:81: error: expected unqualified-id before numeric constant
arduino_output:82: error: expected unqualified-id before numeric constant
arduino_output:82: error: expected `;' before numeric constant
arduino_output:84: error: 'arduino' was not declared in this scope
arduino_output:84: error: expected unqualified-id before numeric constant
arduino_output:85: error: expected unqualified-id before numeric constant
arduino_output:85: error: expected `;' before numeric constant
  • Welcome to Stack Exchange ibrahim. Can you edit your answer to include the example code? Is it the example that is near the bottom of the page that you link to? Also, you may like to take a tour of this site. – Greenonline Jul 30 '15 at 9:10
  • Which processing-arduino package version are you using, processing-arduino.zip or processing2-arduino.zip? Which version of the processing application are you using? Are you using it with the correct version of Processing? – Greenonline Jul 30 '15 at 9:41
2

Note: I am testing this on OS X, so my paths may differ slightly from yours.

I have managed to reproduce your issue, by incorrectly copying the arduino directory, from the unzipped processing2-arduino.zip package, to the libraries directory under the Arduino directory in my home directory, thus

/Users/user/Documents/Arduino/libraries/arduino

Then opening the Arduino IDE and running the arduino_output example, via the menu, File -> Sketchbook -> Libraries -> Arduino -> arduino_output. When I hit the compile button, in the Arduino IDE, the compiler throws up the exact same errors that you describe in your question.

However this is not the correct usage of this package. This package is intended to be used in conjunction with the Processing application, not the Arduino IDE. You should download Processing and then follow the instructions again:

  1. Unzip the library and copy the "arduino" folder into the "libraries" sub-folder of your Processing Sketchbook. (You can find the location of your Sketchbook by opening the Processing Preferences. If you haven't made a "libraries" sub-folder, create one.)

Thus, on OS X, the path should now be

/Users/user/Documents/Processing/libraries/arduino

However, as usual, the documentation on the Arduino website leaves a lot to be desired. Pay careful attention to the following paragraph if you are running OS X or Linux:

Note: if you run Linux, you need to change Arduino.jar into arduino.jar, because Linux is case sensitive and it does not work if you don't change this letter (Arduino.jar is in the folder "library" of this Processing Library).

So,

/Users/user/Documents/Arduino/libraries/arduino/library/Arduino.jar

becomes

/Users/user/Documents/Arduino/libraries/arduino/library/arduino.jar

Relaunch the Processing application. File -> Examples..., opens up a window, scroll down to Contributed Libraries, open that, open Arduino (Firmata), open the arduino_output example. Hit the Run button, and after compiling you should see the window below:

arduino_output window

HTH.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.