Holding value after printing from mqqt

  adc, arduino, c++, raspberry-pi

I have a question for all of you out there is it possible to hold a value in memory after printing it. I will give you an example:

Nodered created interface there is a slider with numbers like slider from 20 to 30. you slide it and choose a value like 25 then that value is send back to arduino or esp serial monitor, there is a command that you can create a variable for that number 25. okay that all good but I understand that when you send the number it triggers the variable 1 time. And I need a function that can remember the value when its time to use it

I am building a greenhouse (how original) and I want to use it wireless, like set the watering of the plants when the temperature is at 22 C, light percentage at 10% and time from 19:00 to 22:00 to water it

And the question is how can I use the variable that was set by the slider in nodered to water my plants at that exact temperature which was set

this is the code I will be using at the end of mqqtFloodInterval I can set what variable I’m gonna get from nodered

void mqttCallback(char* topic, byte* message, unsigned int length) {
  Serial.print("MQTT message received on topic: ");
  Serial.print(". Message: ");
  String messageTemp;
  for (int i = 0; i < length; i++) {
    messageTemp += (char)message[i];
  if (String(topic) == mqttFloodInterval) {
    Serial.print("*** (Flood Interval Received)");

Source: Windows Questions C++