Let's try this then...
boolean sendSerial(long data, byte attempts) {
byte Iattempts = attempts;
Serial.begin(9600);
Serial.print(data);
while (Serial.read() != "*") {
unsigned long startTime1 = millis();
if (millis - startTime = 5000) {
Serial.print("!");
Iattempts =- 1;
}
if (Iattempts = 0) {
return 0;
}
}
Serial.print("+");
while (Serial.read() != "^") {
startTime1 = millis();
if (millis - startTime = 5000) {
Serial.print("!");
Iattempts =- 1;
}
if (Iattempts = 0) {
return 0;
}
}
delay(5);
return 1;
}
long receiveSerial() {
Serial.begin(9600);
long returnData = Serial.read();
Serial.print("*");
while (Serial.read() != "+") {
unsigned long startTime2 = millis();
if (millis - startTime = 5000) {
return 0;
}
}
Serial.print("^");
return returnData;
}
[code]