Processing and Arduino Help


i cannot understand how setup processing able control , communicate arduino without needing type c++/arduino code. read arduino page talks interfacing arduino processing, not understand of it. downloaded library , followed instructions point, when try compile project examples in processing arduino gives me array out of bounds error. need fix or need tweak code? using arduino mega.

here's i'm getting processing editor: (this example came download arduino , processing page on site).

import processing.serial.*;

import cc.arduino.*;

arduino arduino;

color off = color(4, 79, 111);
color on = color(84, 145, 158);

int[] values = { arduino.low, arduino.low, arduino.low, arduino.low,
arduino.low, arduino.low, arduino.low, arduino.low, arduino.low,
arduino.low, arduino.low, arduino.low, arduino.low, arduino.low };

void setup() {
 size(470, 200);
 
 println(arduino.list());
 arduino = new arduino(this, arduino.list()[0], 57600); [size=12]<<< array index out of bounds exception[/size]
 
 for (int = 0; <= 13; i++)
   arduino.pinmode(i, arduino.output);
}

void draw() {
 background(off);
 stroke(on);
 
 for (int = 0; <= 13; i++) {
   if (values == arduino.high)
     fill(on);
   else
     fill(off);
     
   rect(420 - * 30, 30, 20, 20);
 }
}

void mousepressed()
{
 int pin = (450 - mousex) / 30;
 
 if (values[pin] == arduino.low) {
   arduino.digitalwrite(pin, arduino.high);
   values[pin] = arduino.high;
 } else {
   arduino.digitalwrite(pin, arduino.low);
   values[pin] = arduino.low;
 }
}

is error occurring when compile, or when run? array bounds exceptions run-time issues, rather compile time issues.

if it's run-time issue, have arduino connected when trying run program?


Arduino Forum > Forum 2005-2010 (read only) > Software > Interfacing > Processing and Arduino Help


arduino

Comments

Popular posts from this blog

CAN'T INSTALL MAMBELFISH 1.5 FROM DIRECTORY - Joomla! Forum - community, help and support

error: expected initializer before 'void'

CPU load monitoring using GPIO and leds - Raspberry Pi Forums