small medium large xlarge

Back to: All Forums  Arduino
Generic-user-small
08 Jun 2011, 02:41
Gary Phillips (1 post)

Hi,

I got a Wii Nunchuk to try the Wire project. Put in the code from the book for the first sample that outputs to a serial port and everything worked perfectly (amazing-both the code and my ability to type it correctly).

One question: The other projects I tried in the book all start running immediately when the Arduino is plugged into the USB port. For some reason this one does not. Unplugging the USB and plugging it back in does not start polling the nunchuk, neither does pressing the reset button. The only way it starts polling is immediately after the program is downloaded to it.

The transmit led is not on when it is “stuck” (so it’s probably not a serial problem), the nunchuk is attached all the time. I’m using Vista 64.

Does anyone have any thoughts?

Thanks

Generic-user-small
15 Nov 2011, 08:04
Edan Cain (2 posts)

Hi, having the same kind of issue. The code as provided doesn’t compile. For example: should the cube.pde’s first line “import processing.serial.*; “ actually complete with something meaningful? Secondly within the setup method first line there is reference to a member variable P3D, but it is not declared anywhere?

Here are the errors that I am getting within Cube.pde. I came to the website and downloaded the code to ensure I had it correct. Same deal;

Thanks for any feedback. E Cube.cpp:5:18: error: variable or field ‘serialEvent’ declared void Cube.cpp:5:25: error: expected ‘)’ before ‘port’ Cube.cpp:6:1: error: ‘import’ does not name a type Cube.cpp:8:1: error: ‘final’ does not name a type Cube.cpp:9:1: error: ‘final’ does not name a type Cube.cpp:11:1: error: ‘Serial’ does not name a type Cube.cpp:12:1: error: ‘SensorDataBuffer’ does not name a type Cube.cpp:16:1: error: ‘final’ does not name a type Cube.cpp:17:1: error: ‘final’ does not name a type Cube.cpp:18:1: error: ‘final’ does not name a type Cube.cpp:19:1: error: ‘final’ does not name a type Cube.cpp:20:1: error: ‘final’ does not name a type Cube.cpp:21:1: error: ‘final’ does not name a type Cube.cpp:22:1: error: ‘final’ does not name a type Cube.cpp:23:1: error: ‘final’ does not name a type Cube.cpp:24:1: error: ‘final’ does not name a type Cube.cpp:25:1: error: ‘final’ does not name a type Cube.cpp:26:1: error: ‘final’ does not name a type Cube.cpp:27:1: error: ‘final’ does not name a type Cube.cpp:28:1: error: ‘final’ does not name a type Cube.cpp:29:1: error: ‘final’ does not name a type Cube.cpp:30:1: error: ‘final’ does not name a type Cube.cpp:31:1: error: ‘final’ does not name a type Cube.cpp:32:1: error: ‘final’ does not name a type Cube.cpp:36:12: error: ‘WIDTH’ was not declared in this scope Cube.cpp:37:12: error: ‘HEIGHT’ was not declared in this scope Cube.cpp: In function ‘void setup()’: Cube.cpp:47:8: error: ‘WIDTH’ was not declared in this scope Cube.cpp:47:15: error: ‘HEIGHT’ was not declared in this scope Cube.cpp:47:23: error: ‘P3D’ was not declared in this scope Cube.cpp:47:26: error: ‘size’ was not declared in this scope Cube.cpp:48:12: error: ‘noStroke’ was not declared in this scope Cube.cpp:49:13: error: ‘RGB’ was not declared in this scope Cube.cpp:49:19: error: ‘colorMode’ was not declared in this scope Cube.cpp:50:15: error: ‘background’ was not declared in this scope Cube.cpp:51:18: error: ‘class HardwareSerial’ has no member named ‘list’ Cube.cpp:51:24: error: ‘println’ was not declared in this scope Cube.cpp:52:3: error: ‘arduinoPort’ was not declared in this scope Cube.cpp:52:21: error: expected type-specifier before ‘Serial’ Cube.cpp:52:21: error: expected ‘;’ before ‘Serial’ Cube.cpp:53:27: error: ‘LINE_FEED’ was not declared in this scope Cube.cpp: In function ‘void draw()’: Cube.cpp:59:15: error: ‘background’ was not declared in this scope Cube.cpp:60:14: error: ‘pushMatrix’ was not declared in this scope Cube.cpp:62:28: error: ‘translate’ was not declared in this scope Cube.cpp:63:18: error: ‘rotateX’ was not declared in this scope Cube.cpp:64:18: error: ‘rotateY’ was not declared in this scope Cube.cpp:65:18: error: ‘rotateZ’ was not declared in this scope Cube.cpp:66:14: error: ‘scale’ cannot be used as a function Cube.cpp:68:14: error: ‘QUADS’ was not declared in this scope Cube.cpp:68:19: error: ‘beginShape’ was not declared in this scope Cube.cpp:69:15: error: ‘fill’ was not declared in this scope Cube.cpp:69:35: error: ‘vertex’ was not declared in this scope Cube.cpp:98:12: error: ‘endShape’ was not declared in this scope Cube.cpp:100:13: error: ‘popMatrix’ was not declared in this scope Cube.cpp: At global scope: Cube.cpp:105:18: error: variable or field ‘serialEvent’ declared void Cube.cpp:105:25: error: expected ‘)’ before ‘port’

Maik_schmidt_avatar2_pragsmall
15 Nov 2011, 10:23
Maik Schmidt (122 posts)

Hi, Edan!

should the cube.pde’s first line “import processing.serial.*; ” actually complete with something meaningful?

The ‘**’ character means “import all members of the processing.serial package”.

The syntax errors you get are strange. It’s also strange that they appear in a file named Cube.cpp although the code archive does not contain such a file, so I assume you are trying to compile Cube.pde with the Arduino IDE instead of the Processing IDE.

I’ve made the experience that some people are misled by the extension .pde which is the extension for Processing files and for Arduino files (although it will change with the next release of the Arduino IDE). You have to compile and run Cube.pde with the Processing IDE. And you have to compile and upload the sources in the NunchukDemo folder with the Arduino IDE.

Cheers, Maik

Generic-user-small
15 Nov 2011, 23:06
Edan Cain (2 posts)

Hi Maik, your reply answers my question immediately. I was compiling it in the Arduino IDE instead of processing. Read the book first, then went back to do the exercises, skimming it rather than properly re reading. Thanks very much for the quick reply, really appreciate it. Really enjoyed your book, it covers so much of what I wanted to have covered.

Thanks, Edan

Generic-user-small
18 Nov 2011, 18:14
Chris Wolske (1 post)

It wasn’t at all clear in the book that this code needed to be compiled/run in the Processing IDE – I suggest you make that clear in the next version.

You must be logged in to comment