Start a new topic

Arduino Due and Nextion 7''

 

Hello,
I use an Arduino Due and a Nextion 7 ''. If I run the code, the button btn_time_save only works every 6 times.
Please help

void btn_time_savePopCallback(void *ptr)
{
	uint32_t sat, minut, secunda, godina, mesec, dan;
	nr_std.getValue(&sat);
	nr_min.getValue(&minut);
	nr_sec.getValue(&secunda);
	nr_jar.getValue(&godina);
	nr_mon.getValue(&mesec);
	nr_tag.getValue(&dan);
	rtc.adjust(DateTime(godina, mesec, dan, sat, minut, secunda));
	
}

void setup()
{

  /* add setup code here */
	nexInit();
	
	Serial.begin(115200);
	
	
	
	btn_time_save.attachPop(btn_time_savePopCallback, &btn_time_save);
	
	
	
	Wire1.begin();
	rtc.begin();

	 
	Serial.println("Config finish!");
}

NexTouch *nex_listen_list[] =
{
	
	&btn_time_save,
	// 	&btn_menue1,
	NULL
};

void loop()
{

	while(1){
		
		nexLoop(nex_listen_list);
		
		now = rtc.now();
		char buf[12];
		strncpy(buf,"hh:mm:ss\0",100);
		zeit= now.format(buf);
		char buf1[12];
		strncpy(buf1,"DD.MM.YYYY\0",100);
		datum=now.format(buf1);
		uint32_t sve_sekunde=getTimeToday();

		page_id_neu = Nextion_PageID();

		
	}
	
}

 

 

 

 


use debugging techniques

page_id_neu = Nextion_PageID(); That was the mistake

Thanks 

 

MCUs only do exactly as told to do by their programmer without questioning if this is good for them or not MCUs are so loyal, that if the command you give them is to be their demise with that little puff of magic white smoke, they will still attempt to execute it as it ends their existence.


Line 59 might have prevented mistake of mistake, but I might argue not your root mistake made.



Login or Signup to post a comment