Sending commands to Cube from another arduino via serial

The "Cube4" is a 4x4x4 RGB LED cube with an Arduino Leonardo compatible onboard controller. [Product page]
Post Reply
Kastet
Posts: 3
Joined: Fri Feb 13, 2015 1:31 pm

Sending commands to Cube from another arduino via serial

Post by Kastet » Fri Feb 13, 2015 2:07 pm

Hi!

Would anyone give me a hint of how to send commands from one arduino board to Cube via serial?

andrew
Freetronics Staff
Freetronics Staff
Posts: 978
Joined: Sun Jul 14, 2013 7:06 am
Location: Melbourne, Australia
Contact:

Re: Sending commands to Cube from another arduino via serial

Post by andrew » Fri Feb 13, 2015 9:29 pm

Connect a hardware (or software) serial and GND from your other board to the Cube's the RXD and TXD pins on the main board and GND, then have it send commands at 115200 bps as per:
http://www.freetronics.com.au/pages/cub ... mmand-list
You sketch will need to initialise the Cube with

cube.begin(0, 115200)

... to ensure it listens to commands from the RXD/TXD pins.

Kastet
Posts: 3
Joined: Fri Feb 13, 2015 1:31 pm

Re: Sending commands to Cube from another arduino via serial

Post by Kastet » Sat Feb 14, 2015 8:52 am

Ho John!

Thanks for your reply.

Yeah that's what I've tried already. I used hardware serial from my UNO (D0 and D1) but with no luck. TX LED on UNO is blinking so it's indicating that the serial is being used but no such indication from the cube.

UNO | Cube (comms inputs)
TX - RX
RX - TX
GND - GND

Cube sketch

Code: Select all

void setup() {
  cube.begin(0, 115200);
}

void loop(){}
My other board sketch

Code: Select all

void setup() {
  Serial.begin(115200);
}

void loop() {

  allBlue();

  delay(500);

  allRed();

  delay(500);
}

void allBlue() {
  Serial.print("all blue;");
}

void allRed() {
  Serial.print("all red;");
}
What am I doing wrong?


Cheers
K

Kastet
Posts: 3
Joined: Fri Feb 13, 2015 1:31 pm

Re: Sending commands to Cube from another arduino via serial

Post by Kastet » Tue Feb 17, 2015 3:32 am

johnb wrote:Connect a hardware (or software) serial and GND from your other board to the Cube's the RXD and TXD pins on the main board and GND, then have it send commands at 115200 bps as per:
http://www.freetronics.com.au/pages/cub ... mmand-list
You sketch will need to initialise the Cube with

cube.begin(0, 115200)

... to ensure it listens to commands from the RXD/TXD pins.
Ho John!

Thanks for your reply.

Yeah that's what I've tried already. I used hardware serial from my UNO (D0 and D1) but with no luck. TX LED on UNO is blinking so it's indicating that the serial is being used but no such indication from the cube.

UNO | Cube (comms inputs)
TX - RX
RX - TX
GND - GND

Cube sketch

Code: Select all

void setup() {
  cube.begin(0, 115200);
}

void loop(){}

My other board sketch

Code: Select all

void setup() {
  Serial.begin(115200);
}

void loop() {

  allBlue();

  delay(500);

  allRed();

  delay(500);
}

void allBlue() {
  Serial.print("all blue;");
}

void allRed() {
  Serial.print("all red;");
}
What am I doing wrong?


Cheers
K


Posts: 2
Joined: Fri Feb 13, 2015 1:31 pm

andrew
Freetronics Staff
Freetronics Staff
Posts: 978
Joined: Sun Jul 14, 2013 7:06 am
Location: Melbourne, Australia
Contact:

Re: Sending commands to Cube from another arduino via serial

Post by andrew » Wed Feb 18, 2015 3:17 am

You need to use

Code: Select all

cube.begin(1, 115200);
in the cube sketch, the "1" means use the hardware RX/TX pins.

Add a carriage return "\r" to your serial statements in the control sketch, e.g.

Code: Select all

  Serial.print("all blue;/r");
Also, drop the serial speed down to something lower like 9600 and see how you go.

Post Reply