OK so been trying this the reciver sends out the and the transmitter gets it then sends back the <T16.00> but the reciver is not geting it or displaying anything
char inData[24];
char reply[80];
byte index;
boolean started = true;
boolean ended = true;
void setup() {
Serial.begin(9600);
}
void loop() {
Serial.print("<R>");
waitForReply(5000);
}
void waitForReply(unsigned long howLongToWait)
{
index = 0;
unsigned long startTime = millis();
while(millis() - startTime < 3000)
{
char aChar = Serial.read();
if(aChar == '<')
{
started = true;
index = 0;
reply[index] = ' ';
}
else if(aChar == '>')
{
ended = true;
}
else if(started)
{
reply[index] = aChar;
index++;
reply[index] = '\0';
}
if(started && ended)
{
if(inData[0] == 'T')
{
inData[0] = ' ';
int windVal = atoi(inData);
Serial.println(" ");
Serial.print("GotReply");
Serial.print("Temp:");
Serial.print(inData);
Serial.print("C");
Serial.println(" ");
}
started = false;
ended = false;
index = 0;
inData[index] = ' ';
}
}
}