Serial communication lot of variables


I need to send more than 75 variables from an arduino-like (Spark Core) to an arduino and build an array with the data that have been received. I have try a simple serial.write and but over 10 variable it crash.


Where’s your code?

Sounds like you did something wrong.

The code on the arduino-like is a simple Serial.write. I have confirmed that this is working by doing this on the arduino:


The code on the arduino is:

#include <SoftwareSerial.h>
SoftwareSerial ser(2,3);
int var[10];
void setup() {
  Serial.println("SERIAL: BEGIN");
void loop() {
       if(ser.available() >10 ){
for(int i=0; i < 9; i++)  {
var[i] =;

}} returns a character (8-bit value), NOT an int. So, you’re reading half an int into var[0], the other half into var[1], etc. You need to read() two bytes, and assemble them back into an int. One way to do that is:

var[i] = << 8;
var[i] |= & 0xff;

This is assuming the MSB is sent first. I’m not sure if that is correct in this case, but a couple of print statements will tell you for sure.

Ray L.

AND Serial.println will be sending a newline character after each of those.

The examples in serial input basics should meet your requirement


Thanks guys ! I'm going to try that and come back if I have other issues.