Troubleshooting -Genuino uno-uLCD-28PTU- millis() tenths of a secod doesn't work

Hello, i have a problem with millis() code.

  • the time doesn’t work with tenths of a second. -

the platform “Genuino Uno” work only with second.

if i change the code:
“” unsigned long interval2=100;"" with “” unsigned long interval2=1000; “”. the result is the same. so, always the variable "timepist " is 4 seconds.

the code work with Arduino uno connect with Visi-Genie uLCD-28PTU-AR .
but it doesn’t work with Genuino uno and same uLCD

the code is below:

 #include <genieArduino.h>

Genie genie;
#define RESETLINE 4


int timepist =4; //tempo in decimi di secondi di percorrenza pistone


unsigned long interval2=100;   
unsigned long previousMillis2=0;
int secm=0;
int secdm=0;
int primasecdm=0;
boolean contac=false;
int multi=0;

int exe=99;
int exe5=1; 

void setup()
{
   
pinMode(10,OUTPUT); 
pinMode(8,OUTPUT); 
pinMode(9, OUTPUT);//  AVANTI
pinMode(11,INPUT );  
pinMode(12,INPUT);
pinMode(13,INPUT );
pinMode(2,OUTPUT);
pinMode(3,OUTPUT);
pinMode(5,OUTPUT);
pinMode(6,OUTPUT);// SU
pinMode(7,OUTPUT);// GIU
digitalWrite(2,1);  
digitalWrite(3,1);
digitalWrite(5,1);
digitalWrite(6,1);
digitalWrite(7,1);
digitalWrite(8,1);
digitalWrite(9,1);
digitalWrite(10,1);
   
  Serial.begin(9600); 
  genie.Begin(Serial);   
  genie.AttachEventHandler(myGenieEventHandler); 
  pinMode(RESETLINE, OUTPUT); 
  digitalWrite(RESETLINE, 1); 
  delay(100);
  digitalWrite(RESETLINE, 0);  
  delay (3500); 
  genie.WriteContrast(1);
  genie.WriteObject (GENIE_OBJ_FORM, 0, 0);
}


void loop()
{
  genie.DoEvents(); // This calls the library each loop to process the queued responses from the display
  genie.ReadObject(GENIE_OBJ_WINBUTTON,0x14);

 // program
         if(exe==4)
             { contac=true;
  
                if((secdm-primasecdm)>=timepist)
               { ++multi;
                 primasecdm=secdm;
               }
  
               if((multi%2)==0)
               { digitalWrite(6,0); // mov su
                 digitalWrite(7,1);  // reset giu
               }
           
               if((multi%2)!=0)
              { digitalWrite(6,1); // mov su
                digitalWrite(7,0);  // reset giu
               }
  }  
 
// time
       
       if (((unsigned long)(millis() - previousMillis2) >= interval2)&& (contac)) {  
          secdm=secdm+1;      
          previousMillis2=millis();  }


       if(((unsigned long)(millis() - previousMillis2) >= interval2)&& (!contac)) {  
          secdm=0;  
          multi=0;
          primasecdm=0;   
          previousMillis2=millis();   }
} 



// button interface

void myGenieEventHandler(void)
{
  genieFrame Event;
  genie.DequeueEvent(&Event);
  

  if (Event.reportObject.cmd == GENIE_REPORT_OBJ)
  {
    if (Event.reportObject.object == GENIE_OBJ_WINBUTTON)               
    {
              
        switch(Event.reportObject.index){
                           
           
       case 0x14:                    
                if (Event.reportObject.data_lsb == 1) 
                {
                    exe=4;
                  exe5=0;  
                }  
                else 
                   {
                    exe5=1;  
                   }  
                break;            
      
                
              default:
                 break;   
                 }
                 }
                 }
                 }

please, help me.

temporizzatore.ino (2.8 KB)

maybe it is a problem of comunication between the Genuino uno and Visi-Genie uLCD-28PTU-AR .

i have changed the program version of arduino and upgrade the library. i have try to find the problem. but i'm not solved yet

Your code is hard to read because of poor formatting. Use the Auto-Format tool

I can't see any line that changes the variable contac to false

I have no idea what the genieArduino library does or how it does it.

...R