the reciver is sending for temp to the transmitter then the transmitter sends back the value for the of temp
the reciver then displays the value.
then the reciver sends For Humidity to the transmitter then the transmitter sends back the value for the of temp
the reciver then displays the value.
and so on
I tryd this but it keeps sending then out and cant get the value back delays dont work
void loop()
{
lcd.setCursor(0, 0);
lcd.print("Temp:");
lcd.setCursor(0, 1);
lcd.print("Humidity:");
lcd.setCursor(0, 2);
lcd.print("Moisture:");
lcd.setCursor(0, 3);
lcd.print("Voltage:");
Serial.print("<R>");
Serial.print("<B>");
Serial.print("<C>");
Serial.print("<D>");
while(Serial.available() > 0)
{
char aChar = Serial.read();
if(aChar == '<')
{
started = true;
index = 0;
inData[index] = ' ';
}
else if(aChar == '>')
{
ended = true;
}
else if(started)
{
inData[index] = aChar;
index++;
inData[index] = ' ';
}
}
if(started && ended)
{
// Use the value
if(inData[0] == 'T')
{
inData[0] = ' ';
int windVal = atoi(inData);
Serial.println(" ");
Serial.print("Temp:");
Serial.print(inData);
Serial.print("C");
Serial.println(" ");
lcd.setCursor(11, 0);
lcd.print(inData);
lcd.print("C");
}
else if(inData[0] == 'H')
{
inData[0] = ' ';
int temp = atoi(inData);
Serial.println(" ");
Serial.print("Humidity:");
Serial.print(inData);
Serial.print("%");
Serial.println(" ");
lcd.setCursor(11, 1);
lcd.print(inData);
lcd.print("%");
}
else if(inData[0] == 'M')
{
inData[0] = ' ';
int temp = atoi(inData);
Serial.println(" ");
Serial.print("Moisture:");
Serial.print(inData);
Serial.println(" ");
lcd.setCursor(11, 2);
lcd.print(inData);
}
else if(inData[0] == 'V')
{
inData[0] = ' ';
int temp = atoi(inData);
Serial.println(" ");
Serial.print("Voltage:");
Serial.print(inData);
Serial.print("Volts");
Serial.println(" ");
lcd.setCursor(11, 3);
lcd.print(inData);
lcd.print("V");
}
started = false;
ended = false;
index = 0;
inData[index] = ' ';
}
}