Pages: [1]   Go Down
Author Topic: Multiple Arduinos  (Read 523 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi.
I am working on a project that requires two arduinos (one local & one wireless), re software: I am using the standard firmata & processing
I have started by assessing whether this is possible or not by using the code below to turn an led on on each board.  The codes compiles without any errors nor do I get any errors at runtime, however, it just will not communicate with the two boards.  Has anyone attempted this before or would you have any advise for me..

Big Thanks,

Tactiledata

Code:
import processing.serial.*;

import cc.arduino.*;
Arduino ard1, ard2;

void setup() {
  size(470, 200);
 
  println(Arduino.list());
  ard1 = new Arduino(this, Arduino.list()[0], 57600);
  ard2 = new Arduino(this, Arduino.list()[2], 57600);
 
  for (int i = 0; i <= 13; i++)
    ard2.pinMode(i, Arduino.OUTPUT);
   
}

  for (int i = 0; i <= 13; i++)
   
    ard1.pinMode(i, Arduino.OUTPUT);
}

void draw() {
 
}

void keyPressed() {
 
  if (key == 'q') {
    ard1.digitalWrite(13, Arduino.HIGH);
  }
 
    if (key == 'a') {
    ard1.digitalWrite(13, Arduino.LOW);
  }
    if (key == 'w') {
    ard2.digitalWrite(13, Arduino.HIGH);
  }
 
    if (key == 's') {
    ard2.digitalWrite(13, Arduino.LOW);
  }
   
   
}
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 613
Posts: 49270
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Code:
  for (int i = 0; i <= 13; i++)
    ard2.pinMode(i, Arduino.OUTPUT);
Great. You just trashed the serial pins (0 and 1).

Quote
however, it just will not communicate with the two boards.
Well, now, there's a surprise.
Logged

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 626
Posts: 34122
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Just to get your thinking straight:-
Quote
The codes compiles without any errors
That means there is nothing wrong with the syntax, it just means the compiler knows how to translate your instruction into machine code. It doesn't mean your instructions are right.

Quote
nor do I get any errors at runtime
And exactly what is going to give you a run time error? This is an embedded processor with no trap mechanism, there is no such thing as a run time error.   
Logged

Pages: [1]   Go Up
Jump to: