Go Down

Topic: Processing controlling arduino. (Read 983 times) previous topic - next topic

DFlux

I don't know what I'm doing wrong. This is the first time I'm trying to control arduino outputs with processing and nothing is happening. x.x!

Processing Code:

Code: [Select]
import processing.serial.*;
import cc.arduino.*;
Arduino ard;
int led = 22;
boolean on = false;
void setup () {
  size(400, 300);       
  //println(Arduino.list());
  ard = new Arduino(this, Arduino.list()[2], 9600);  //My arduino is on COM5
  ard.pinMode(led, Arduino.OUTPUT);
  background(0);
}

void draw() {
  if(on) {
    fill(0,0,0);
  } else {
    fill(255,0,0);
  }
  rect(0,0,400,300);
}
void mouseClicked() {
  if(on) {
    on = false;
    ard.digitalWrite(led, Arduino.LOW);
  } else {
    on = true;
    ard.digitalWrite(led, Arduino.HIGH);
  }
}


Arduino Code:

Code: [Select]
void setup() {
  Serial.begin(9600);
}

void loop() {
}


Tks

danimath

That's because nothing in the loop. The Arduino just repeats the empty loop and does nothing.
http://danimathblog.blogspot.com

#define true '/'/'/'
#define false '-'-'-'

DFlux

But isn't processing supposed to set things on arduino?

What am I supposed to do? Didn't find any references about this. Only to processing.

AWOL

Were you perhaps thinking of Firmata?
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

danimath

No. Processing isn't supposed to set things on arduino, but you can do it - as with C, Java, Perl, Python, ....

Link: http://www.arduino.cc/playground/Interfacing/Processing
http://danimathblog.blogspot.com

#define true '/'/'/'
#define false '-'-'-'

DFlux


No. Processing isn't supposed to set things on arduino, but you can do it - as with C, Java, Perl, Python, ....

Link: http://www.arduino.cc/playground/Interfacing/Processing


I used that post to help me.
That example is in processing. Even if I copy it doesn't work.
That's why I'm not sure if I need to program something into the arduino too.

AWOL

Yes, and did you read the bit about Firmata?
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Grumpy_Mike

Quote
That's why I'm not sure if I need to program something into the arduino too.

Yes you do need something in the arduino.
You can use the code called Firmata, but it is not very flexible. Or better still write code in the arduino that does what exactly what you want.

Go Up