Error in processing code

edited January 2014 in Arduino

Hello! I'm quite new in this processing thing. Already worked with arduino. So now I'm trying to connect the arduino with processing. I have attached a capacitive touch sensor to my arduino and I'm trying to get sound out of the pins when they are touched. I was informed that I should do this in processing but I still get this error. Can somebody help me?

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

// declariatie van globale variabelen
Minim minim;
AudioSample sound1;
Serial myPort;
//String aReadout = "pin 1 was just touched"; 


// initializatie van het programma
void setup() {
  size(100, 100);
  background(0);
  frameRate(60); 

  minim = new Minim(this);
  sound1 = minim.loadSample( "sound1.mp3",512);   // lees de soundfile in de buffer

  println(Serial.list()); // toon alle seriele poorten op de machine
  myPort = new Serial(this, Serial.list()[5], 9600);  // open een nieuwe seriele poort
  myPort.bufferUntil('\n');
}




// deze functie wordt automatisch aangeroepen als er seriele data ontvangen wordt

void serialEvent(Serial myPort) 
{ 
  String inString = myPort.readString();
  println(inString);
  if (inString != null) 
  {
    inString = trim(inString);  // verwijder spaties en tabs rond de string

    int[] values = int(split(inString, ",")); // splits de string in blokken op basis van de comma en zet om naar integers

    /* HIER WIL LEZEN EN ANALYSEREN WAT DE ARDUINO JE HEEFT TOEGESTUURD. 
        HET RESULTAAT ZIN IN DE ARRAY values
       als het goed is zit er in values[0] de integerwaarde voor aan of uit en in values[1] het nummer van de pin
    */


    if(int[0] == 1)   // button wordt aangeraakt
    {
        // welke button?
        if(int[1] == 8)   // is het button 8?
        {
          println("button 8 wordt ingedrukt");
        }
        else if(int[1] == 9)
        {
          // etc.

        }
    }
    else if(int[0] == 0)
    {
        // welke button?
        if(int[1] == 8)   // is het button 8?
        {
          println("button 8 wordt losgelaten");
        }
        else if(int[1] == 9)
        {    
          // etc.

        }
    }

  }
}
// EIND VAN DE SERIELE EVENT AFHANDELING

void draw() 
{


}   

!">image alt textScreen Shot 2014-01-17 at 14.12.07

Answers

  • Screen Shot 2014-01-17 at 14.12.07

    This is the error

  • edited January 2014 Answer ✓

    Java doesn't allow its reserved keywords to be labels for variables, methods, classes, interfaces or whatever!!! [-(

    You can't name a variable int like you're doing from line #46 and on!!! [-X
    Perhaps you've meant the variable values you've declared as type int[] @ line #38? :-\"

  • Thanks so much! I've got values now. But still got no sound. I changed the mp3 file for a wav file. It still won't work and I also got no print ln. Do you know what I did wrong? I'm sorry for being such a dummy!

    Screen Shot 2014-01-17 at 15.17.05

  • edited January 2014

    Sorry I can't help ya out. Since I'm in Linux w/ 64-bit OpenJDK 7 rather than Oracle's, Minim doesn't even bleep! :(|)

Sign In or Register to comment.