What I'm trying to do is some sort of baton with an accelerometer plugged to a Wiring S board. Processing would pretty much do the Graphic part, a sine wave to be precise, according to the accelerometer's X and Y axis values. However, when I try to run the Processing program, I get a nullPointerException, at line 41:
java.lang.NullPointerException
at processingCiclo2.<init>(processingCiclo2.java:41)
I tried moving the line by putting line breaks above it, but it keeps displaying the same line, and I don't know what to do.
Here's the code.
import processing.serial.*;
import ddf.minim.*;
import ddf.minim.signals.*;
import ddf.minim.analysis.*;
import ddf.minim.effects.*;
Serial myPort;
Minim minim;
AudioPlayer baseLoop;
AudioPlayer player2;
int linefeed = 10;
int numSensors = 2;
int sensors[];
int x1 = sensors[0];
int y1 = sensors[1];
float p; //Promedio entre valores x, -y-,
float theta = 0.0; // Start angle at 0
float amplitude = 75.0; // Height of wave
int xspacing = 8; // How far apart should each horizontal location be spaced
int w; // Width of entire wave
float period = 500.0; // How many pixels before the wave repeats
float dx; // Value for incrementing X, a function of period and xspacing
float[] yvalues; // Using an array to store height values for the wave
void setup()
{
size (800, 800);
println(Serial.list());
myPort = new Serial (this, Serial.list()[0], 9600);