This is a repost because so far I have not received an answer.
I decided to try the Processing sketch on page 131-132 of the Recipe book. When I try to run it it stops at #include <Wire.h> At the bottom it says unexpected character: 'i'
I was seeing some posts about a library. If that is true I have no clue how to get it, build it or whatever. I messed around with trying something in Wordpad. Well! Nothing I tried worked. I guess I didn't think this was going to be this difficult. I want to try to get this going as soon as I can so that I can go on to other programs. I think I need to sol it.
Here is the code:
/*
* WiichuckSerial
* Uses Nunchuck Library discussed in recipe 16.5
* sends comma-seperated values for data
* Label string seperated by commas can be used by recieving program
* to identify fields
*/
#include <Wire.h>
#include "Nunchuck.h"
// values to add to the sensor to get zero reading when centered
int offsetX, offsetY, offsetZ;
#include <Wire.h>
#include "Nunchuck.h"
void setup()
{
Serial.begin(57600);
nunchuckSetPowerpins()
nunchuckInit(); // send the intitialization handshake
nunchuckRead; // ignore the first time
delay(50);
}
void loop()
{
nunchuckRead();
dalay(6);
nunchuck_get_data();
boolean btnC = nunchuckGetValue(wii_btnC);
boolean btnC = nunchuckGetValue(wii_btnZ);
void printButton(int value)
{
if( value != 0)
value = 127;
Serial.print(value,DEC);
Serial.print(",");
}
int addReading( int value, int min, int max, int offset)
{
value = constrain(value + offset, min, max);
value = map(value, min, max, -127, 127);
return value;
}
I am new to doing this stuff. I finally figured out you need to have a separate program to "process" the code. I have been trying to do some projects that are in the Arduino cookbook 2nd Edition. I have done simple light projects and the board appears to be good. I purchased an adapter for the Wii Nunchuck. The Arduino program did seem to work but I decided to try the processing code shown on page 130-131. I built the code and had checked it but It doesn't seem to want to Process it.
It stop at: #include <Wire.h>
then there is: #include "nunchuck.h"
It talks about the Nunchuck library on recipe 16.5. What program do I use to build it with?
This is far more complex than I wanted it to be.
Looking on the internet I saw it was talking about a library. I have no clue how to build one or get one. What would I use to even build one. I don't get it!
I would any help I can get!
Here is the code:
/*
* WiichuckSerial
* Uses Nunchuck Library discussed in recipe 16.5
* sends comma-seperated values for data
* Label string separated by commas can be used by receiving program
* to identify fields
*/
#include <Wire.h>
#include "Nunchuck.h"
// values to add to the sensor to get zero reading when centered
int offsetX, offsetY, offsetZ;
#include <Wire.h>
#include "Nunchuck.h"
void setup()
{
Serial.begin(57600);
nunchuckSetPowerpins()
nunchuckInit(); // send the intitialization handshake
nunchuckRead; // ignore the first time
delay(50);
}
void loop()
{
nunchuckRead();
dalay(6);
nunchuck_get_data();
boolean btnC = nunchuckGetValue(wii_btnC);
boolean btnC = nunchuckGetValue(wii_btnZ);
void printButton(int value)
{
if( value != 0)
value = 127;
Serial.print(value,DEC);
Serial.print(",");
}
int addReading( int value, int min, int max, int offset)
{
value = constrain(value + offset, min, max);
value = map(value, min, max, -127, 127);
return value;
}
I have an Arduino UNO. I was able to write the program for Serial Mouse sketch shown on that page and it seemed to be ok and I was able to download it to the board. However when I tried to create the processing sketch it doesn't want to complete. It says:
Can not find a class or type named "Dimension"
here is the entire processing code:
// Processing Sketch
/*
* ArduinoMouse.pde (Processing sketch)
*/
/* WARNING: this sketch takes over your mouse
* Press escape to close running sketch
*/