Visi-genie preset slider value on startup

Using an Arduino Uno and a uLCD-32PTu, I have coded an LED digits widget and my Slider0 value to show the value of 150 int upon start up(in the setup portion of the code) of the arduino powering the LCD to make a set point for a temperature sensitive relay switch. When I power on the device, the Slider0 value reads 150 on the screen and the corresponding LED digits value also reads 150 like it should, however my arduino ignores this value on the screen until I manually adjust the slider value on the screen itself. How do I get my arduino to acknowledge this preset 150 value upon startup without any user interaction?

Here is my code...

#define CHANNEL1 8 //LowSpeed RELAY
#define CHANNEL2 9 //HighSpeed RELAY

#include <genieArduino.h>

#include <OneWire.h>
#include <DallasTemperature.h>

#define ONE_WIRE_BUS 2 //DALLAS serial sensors go into input 3
// Setup a oneWire instance to communicate with any OneWire devices
OneWire oneWire(ONE_WIRE_BUS);
// Pass our oneWire reference to Dallas Temperature. 
DallasTemperature sensors(&oneWire);
DeviceAddress coolant = { 0x28, 0x1F, 0x70, 0x66, 0x04, 0x00, 0x00, 0x0B };
DeviceAddress cooly = { 0x28, 0x6C, 0x5A, 0x66, 0x04, 0x00, 0x00, 0x8F };

int sliderVal = 150;


int slider0_val;//Set point for fan1
int slider1_val;//Set point for fan2 
int humidity, t, temp;



void setup()
{
  
  pinMode(CHANNEL1, OUTPUT); //Low Speed Fan RELAY
  pinMode(CHANNEL2, OUTPUT); //High Speed Fan RELAY

  sensors.begin(); // DALLAS sensors begin reading
  sensors.setResolution(coolant, 10);
  sensors.setResolution(cooly, 10);
  
  genieBegin (GENIE_SERIAL, 56000);  //Serial0 for 4D Display
  
  genieAttachEventHandler(myGenieEventHandler);

  //Reset the Display (change D4 to D2 if you have original 4D Arduino Adaptor)
  pinMode(4, OUTPUT);  // Set D4 on Arduino to Output (4D Arduino Adaptor V2 - Display Reset)
  digitalWrite(4, 1);  // Reset the Display via D4
  delay(100);
  digitalWrite(4, 0);  // unReset the Display via D4

  delay (3500); //let the display start up

    genieWriteObject(GENIE_OBJ_LED_DIGITS, 6, sliderVal);// THIS LINE WRITES THE 150 VALUE TO THE SCREEN THAT I WANT 
    genieWriteObject(GENIE_OBJ_SLIDER, 0, sliderVal);//WRITES THE SAME VALUE BUT IS BEING IGNORED BY IF COMMANDS
//IN THE LOOP UNTIL MANUALLY ADJUSTED ON LCD AFTER START UP...
}



void loop()
{
  static long waitPeriod = millis();

  genieDoEvents(); // Do this every loop, checks the input buffer for data from the display and runs myGenieEventHandler()

  //Read from sensor every 100ms and write to the display
  if (millis() >= waitPeriod)
  {
    temp = (t * 1.8) + 32; //Convert *C to *F.
    
    float inside = sensors.getTempF(coolant);
    float outside = sensors.getTempF(cooly);
    
    float tempF;
    
    sensors.requestTemperatures();    
    Serial.println (inside);////////GOOD CODE 
    Serial.println (outside);///////GOOD CODE AGAIN... YAY!
    
    genieWriteObject(GENIE_OBJ_LED_DIGITS, 0, inside);//The first line of code in the section gets ignored for some reason...?? //copy and paste
    genieWriteObject(GENIE_OBJ_ANGULAR_METER, 0, inside);//HOME SCREEN TEMP GAUGE.........FORM 0 
    genieWriteObject(GENIE_OBJ_LED_DIGITS, 0, inside);//HOME SCREEN TEMP..................FORM 0
    genieWriteObject(GENIE_OBJ_LED_DIGITS, 1, inside);//LOW SPEED FAN CONTROL.............FORM 1
    genieWriteObject(GENIE_OBJ_LED_DIGITS, 7, inside);//HIGH SPEED FAN CONTROL............FORM 5
    genieWriteObject(GENIE_OBJ_LED_DIGITS, 9, outside); //HOME SCREEN COOLANT OUTPUT SENSOR........FORM 0 
    genieWriteObject(GENIE_OBJ_ANGULAR_METER, 1, outside);//HOME SCREEN COOLANT OUTPUT GAUGE.......FORM 0 
    //genieWriteObject(GENIE_OBJ_LED_DIGITS, 6, sliderVal);//TEST
    //genieReadObject(GENIE_OBJ_SLIDER, 0);//TEST
    
    
    waitPeriod = millis() + 10; // rerun this code in another 100ms time.
 
  if (slider0_val > inside)// FAN SLIDER SET POINT WITH DALLAS SENSOR...For some reason it's  responding in polar opposites of the command? 
  {
    digitalWrite(CHANNEL1, HIGH); //FAN
  }
  else
  {
    digitalWrite(CHANNEL1, LOW); //FAN
  }
 /////////////////////////////////////////////////////
  
  if (slider1_val > inside)
  {
    digitalWrite(CHANNEL2, HIGH);
  }
  else
  {
    digitalWrite(CHANNEL2, LOW);
  }
 
 
 
  }
 
}

void myGenieEventHandler(void)
{
  genieFrame Event;
  genieDequeueEvent(&Event);

  //If the cmd received is from a Reported Event
  if (Event.reportObject.cmd == GENIE_REPORT_EVENT)
  {
    if (Event.reportObject.object == GENIE_OBJ_SLIDER)            // If the Reported Message was from a Slider
    {
      if (Event.reportObject.index == 0)                          // If Slider0
      {
        slider0_val = genieGetEventData(&Event);                  // Receive the event data from the Slider0
      }
    }
  }

 //If the cmd received is from a Reported Event
  if (Event.reportObject.cmd == GENIE_REPORT_EVENT)
  {
    if (Event.reportObject.object == GENIE_OBJ_SLIDER)            // If the Reported Message was from a Slider
    {
      if (Event.reportObject.index == 1)                          // If Slider1
      {
        slider1_val = genieGetEventData(&Event);                  // Receive the event data from the Slider1
      }
    }
  }
//////////////////////////////////////////////////////////////////////////////
 
  //If the cmd received is from a Reported Object, which occurs if a Read Object is requested in the main code, reply processed here.
  if (Event.reportObject.cmd == GENIE_REPORT_OBJ)
  {
    
    //Put code in here, like the above, if you want to process data when you have used a genieReadObject in your main loop
    //Currently there are none, so this section has no code.
    //Filter out the Object and the Index like above, and then same the data into a variable as required.
  }
}

BUMP Should I maybe ask this question on the 4D systems forum? Is this not an Arduino issue?

Is this not an Arduino issue?

It really isn't clear what the problem is. The value of sliderVal is used as input to set the graphics, but the values in slider0_val and slider1_val are set when events occur, and are what are tested in the if statements.

If you want slider0_val and slider1_val to be 150, initially, why do you set them to 0?

If you want slider0_val and slider1_val to be 150, initially, why do you set them to 0?

Thanks for pointing this out!! I hadn't realized I did not set my ints to 150 like this...

int slider0_val = 150;
int slider1_val = 150;

Problem solved! I guess I just needed a fresh set of eyes to look over my code XD
Thanks for the tip!

Now, what is going to happen when you decide that the slider should start at 175?