nextion slider

hello everyone, hope you guys can help. have a problem with arduino program which should show data from nextion slider to arduino pin3 (PWM) value, everything from nextion should be correct .. please see arduino program please
greetings holmenshus

Arduino:

#include <Nextion.h>

const int pinLED = 3; //PWM pin

char buffer[100] = {0};
//Declare your Nextion objects , pageid, component id., comLedponent name

NexSlider h0 = NexSlider(0,1,"h0");
NexTouch *nex_listen_list[] = {  
  &h0, 
  NULL
};
void h0PopCallback(void *ptr){
     //LED pwm fra nextion slider kan ikke få nogle værdier fra slider??    
          uint32_t number = 0;
          h0.getValue(&number); 
          int value = map(number, 0,100,0,255);
          analogWrite(pinLED, value);
        memset(buffer, 0, sizeof(buffer));
          itoa(value, buffer, 10); 
         // statusPWM.setText(buffer); 
     }
void setup() {
     Serial.begin(9600);
     pinMode(pinLED, OUTPUT); 
     nexInit();     
     h0.attachPop(h0PopCallback);    
}
void loop() {
  nexLoop(nex_listen_list); 

}

Hello Holmenshus
Welcome to the forum.

Please read 'General Guidance and How to use the Forum' at the top of the display section. Please follow the instructions then go back and modify your code with code tags.

The advice I can give you is limited as I don't use the Nextion libraries. I can tell you that the original libraries from ITEAD are full of bugs. If you look in 'using Nextion displays with Arduino' you will find a link to improved Nextion libraries by Ray Livingston, Ray has fixed many of the bugs.

If you read 'using Nextion displays with Arduino' and follow the examples you will find code for reading a slider that works. It does not however send it to PWM, that bit you will have to do yourself.

Have fun.

Thanks for the answer, before I asked in the forum I searched the web for ideas on how to fix it. have found the program shown but it does not work (led dimmer) so if anyone has a tip two solution then if anyone can help it will be fine ..
greetings Holmenshus.