Display 0 does not exist: Accelerometer & RGB LED

Hey there,

I’m hoping someone out there may be able to help me.

Arduino Version: 1.0.6
Processing Version: 1.5.1

I’m making a really basic circuit for a college class using a standard RGB LED and a G Force 3D-3 axis accelerometer on a arduino uno.

Essentially what happens is depending on the movement on the accelerometer a different light will turn on, no movement = no light. Youtube vid of it here

Arduino Code:

#define RED 3

#define GREEN 5

#define BLUE 6

#define delayTime 40

byte redVal=255;

byte greenVal=0;

byte blueVal=0;


///////////////

int sensor1=0;

int sensor2=0;

int max1=0;
int max2=0;
int min1=1000;
int min2=1000;

int cutoff=399;

///////////////


void setup()

{
  
/////////

Serial.begin(9600);

//pinMode(A0,INPUT);

//pinMode(A2,INPUT);



/////////

pinMode(RED, OUTPUT);

pinMode(GREEN, OUTPUT);

pinMode(BLUE, OUTPUT);

digitalWrite(RED, 0);

digitalWrite(GREEN, 0);

digitalWrite(BLUE, 0);

}

void loop()

{
  /////////
  
//This loop checks how much the accelerometer is moving
  
 max1=0; 
  
  for (int i=0; i<20; i++)
 {   
   sensor1=analogRead(A0);
  //sensor2=analogRead(A2);
  
  if (sensor1>max1)
  {
    max1=sensor1;
  }

   delay(10);
 }
 
 
 
 
 
 
 
 //These print off the value within the bracket on the serial monitor
// Serial.print(max1);
// Serial.print("\n");
 
 analogWrite( BLUE, 0 );
 
 
 
 if (max1>460)
  {
    analogWrite( RED, 250 );
    analogWrite( BLUE, 0 );
    analogWrite( GREEN, 0 );
    
    Serial.print(max1);
    Serial.print("  green \n");
    
    delay(1000);
    
  }
  
  else if (max1>410)
  {
    analogWrite( RED, 0 );
    analogWrite( BLUE, 250 );
    analogWrite( GREEN, 0 );
    
    Serial.print(max1);
    Serial.print("  blue \n");
    
    delay(1000);
  }
  
    else if (max1>360)
  {
    analogWrite( RED, 0 );
    analogWrite( BLUE, 0 );
    analogWrite( GREEN, 250 );
    
    Serial.print(max1);
    Serial.print("  red \n");
    
    delay(1000);
  }
  
  
  else
  {
  analogWrite( BLUE, 0 );
  analogWrite( RED, 0 );
  analogWrite( GREEN, 0 );
  
  Serial.print(max1);
 Serial.print("  off \n");
 delay(1000);
  }

I did the arduino firmata last night for processing so I could add an audio element (which like the light will turn on depending on the movement).

Processing Code:

import processing.serial.*;
import cc.arduino.*;
import ddf.minim.*;

Minim minim;
AudioPlayer sound1, sound2;

int val1,val2,val3;

Arduino arduino;


void setup()
{
  size(800,600);

  println(Arduino.list());
  arduino = new Arduino(this, Arduino.list()[0], 9600);
  arduino.pinMode(3, Arduino.OUTPUT);
  arduino.pinMode(5, Arduino.OUTPUT);
  arduino.pinMode(6, Arduino.OUTPUT);
  background(255);
  minim = new Minim(this);
  sound1 = minim.loadFile("sound1.mp3", 2048);
  sound2 = minim.loadFile("sound2.mp3", 2048);

}

void draw()
{
val1 = arduino.analogRead(0); 
print("Pin 0: "); 
println(val1);
val2 = arduino.analogRead(2); 
print("Pin 2: ");
println(val2);
val3 = arduino.analogRead(4);
print("Pin 4: ");
println(val3);

//if it detects a slight shake
//The logic is: if the value read on pin0 is greater than 600 and less the 650
//OR the value read on pin2 is greater than 600 and less the 650
//OR the value read on pin4 is greater than 600 and less the 650
//the turn on digital pin 3, turn off pin 5 & 6, 
//stop sound 2 (just in case it is playing, if stop doesnt work use pause() instead) rewind sound 1 and play sound 1
if ((val1>600)&&(val1<650)||(val2>600)&&(val2<650)||(val3>600)&&(val3<650)) {
  arduino.digitalWrite(3, arduino.HIGH);
  arduino.digitalWrite(5, arduino.LOW);
  arduino.digitalWrite(6, arduino.LOW);
 // sound1.stop();
  sound1.rewind(); 
  sound1.play();
}

if ((val1>650)&&(val1<700)||(val2>650)&&(val2<700)||(val3>650)&&(val3<700)) {
  arduino.digitalWrite(5, arduino.HIGH);
    arduino.digitalWrite(3, arduino.LOW);
  arduino.digitalWrite(6, arduino.LOW);
  //sound2.stop();
  sound2.rewind(); 
  sound2.play();
}

if ((val1>700)||(val2>700)||(val3>700)) {
  arduino.digitalWrite(6, arduino.HIGH);
  arduino.digitalWrite(3, arduino.LOW);
  arduino.digitalWrite(5, arduino.LOW);
  //sound3.rewind(); sound3.play();
}
}


void stop()
{
  // always close Minim audio classes when you are done with them
  sound1.close();
  sound2.close();
  
  // always stop Minim before exiting.
  minim.stop();
 
  super.stop();
}

When I run the sketch I get this error:

Display 0 does not exist, using the default display instead.

WARNING: RXTX Version mismatch
Jar version = RXTX-2.2pre1
native lib Version = RXTX-2.2pre2
[0] “/dev/tty.Bluetooth-Incoming-Port”
[1] “/dev/cu.Bluetooth-Incoming-Port”
[2] “/dev/tty.Bluetooth-Modem”
[3] “/dev/cu.Bluetooth-Modem”
[4] “/dev/tty.usbmodemfd121”
[5] “/dev/cu.usbmodemfd121”

I’ve tried replacing it with 4 and 5. I read online that I should use Processing 2.0 but my lecturer wants us all to use 1.5.

Any help would be awesome. Thanks!