I have a huge code (more than 10000 lines), but is something like this:
void setup()
{
Serial.begin(9600); // PC
Serial1.begin(1200); // Flex Led
Serial2.begin(1200); // FL do BMV que testa o BMC
Serial3.begin(1200); // FL do BMC que testa o BMV
Wire.begin(); // entra como mestre i2c
analogWrite(5, 100);
}
void loop
{
Wire.beginTransmission(9);
Wire.write('a');
Wire.endTransmission();
Wire.beginTransmission(10);
Wire.write('b');
Wire.endTransmission();
if (Serial2.available()>0) Serial.print( Serial2.read());
if (Serial3.available()>0) Serial.print( Serial3.read());
if (Serial1.available()>0) Serial.print( Serial1.read());
}
My problem is, Serial(2,3,1).available is returning nothing, but I can read the characters with a scope.
I know it's not a connection problem... does someone know about any "compatibility" problem because to many communications + PWM?
I'm trying to eliminate the possibilities, I'm also considering a RAM problem (but the sofware is not freezing anyway).
when I said "scope" I mean that I use another Arduino connected in paralel with the comunication (for debug pourposes) and this other Arduino read the characters as expected, but at the same time the "main Arduino" doesn't receive anything =/
My code is much more complicated than I show (its about 20000 lines O.O ), but it's about the in the final... I'm really thinking the problem is about RAM, because I'm using a lot of libraries like wire, spi, flash and EEPROM, and have a lot of strings to a lcd (i2c). Of course I'm using Flash to avoid overflow the RAM with strings, but I'm think it's not enough...
Just to clarify, you mean they are returning zero? How do you know this? You might be getting a non-printable character.[/quote
I means if I do "variable = Serial2.available()", variable will be always 0, but actualy I can see that's not true.