I am pretty sure I follow you code, my concern is that it does not address bi-directional communication, and simply forwards everything to the my serial unless its the exit clause... am I understanding the code properly...
Thanks form the help guys
PeterH:
You're right that the problem is here:void VIPassing() // pass just data to the unit
{
do
{
SerialinByte = Serial.read();
if (mySerial.available())
{
Serial.write(mySerial.read());
}
if (Serial.available())
{
mySerial.write(Serial.read());
}
}
while (SerialinByte != 33);
}
I suggest you get rid of the global, and do it something like this:
void VIPassing() // pass just data to the unit
{
char c = 0;
while(true)
{
// wait for a character to arrive
while(Serial.available() == 0)
{
// do nothing
}
c = Serial.read();
if(c == '!')
{
break; // out of the enclosing while loop
}
else
{
mySerial.write(c);
}
}
}