*Beginner* Controlling LED 12V LED Strip With NEXTION SCREEN

Hey, I’ve recently had issue with controlling the LED Strips with a nextion screen.

^This is the LED Strip

I’m using a 3.2" Nextion Screen, and the basic summary of the design of the interace, is there that there is a homescreen, which allows you to click on a button to switch onto the mirror lighting page ( this all works fine as it has nothing to do with the arduino)

I then have an dual state on and off button, that i want to turn the LED strips on and off, when theyr’re clicked.

I have a slider with can then vary the intensity.

Without the Nextion Screen, the LED strip lights up fine, and here is the circuit i used

Except, i switched the pin from the transistor, from the digital pin 2, to A0, so i could vary the brightness intensity from the screen

Here is the code

#include <Nextion.h>
NexDSButton bt0 = NexDSButton(1, 4, “bt0”); // on button
NexSlider h0 = NexSlider(1, 5, “h0”); // brightness slider
NexButton b0 = NexButton(0, 2, “b0”); // button to mirror lighting page
NexButton b1 = NexButton(1, 3, “b1”); // back to home screen button
NexPage page0 = NexPage(0, 0, “Hpage”); // home page
NexPage page1 = NexPage(1, 0, “MLighting”); // lighting page
const int LEDPin = A0;
const int LEDValueMax = 255;
const int LEDValueMin = 0;
int LEDValue = 0;
NexTouch nex_listen_list[] =
{
** &b1,
*
** &bt0,**
** &h0,**
** &page0,**
** &page1,**
** NULL**
};
void h0PopCallBack(void *ptr){
** uint32_t BValue = 0;**
** h0.getValue(&BValue);**
** if (BValue==0){**
** h0.getValue(&BValue);**
** }**
** if (BValue==0){**
** h0.getValue(&BValue);**
** }**
** if (BValue==0){**
** h0.getValue(&BValue);**
** }**
** if (BValue==0){**
** h0.getValue(&BValue);**
__ analogWrite(LEDPin, (BValue*2.55));__
** }**
** Serial2.print(“BCounter.val=”);**
** Serial2.print(BValue);**

** Serial2.write(0xff);**
** Serial2.write(0xff);**
** Serial2.write(0xff);**

** Serial2.end();**
** Serial2.begin(115200);**
}
void bt0PopCallback(void *ptr)
{
** uint32_t BValue = 0;**
** h0.getValue(&BValue);**

** uint32_t dsbutton = 0;**
** bt0.getValue(&dsbutton);**
** if(dsbutton == 1)**
__ analogWrite(LEDPin, (BValue*2.55));__
else {
** analogWrite(LEDPin, (0));**
** bt0.attachPop(bt0PopCallback);**

** Serial2.write(0xff);**
** Serial2.write(0xff);**
** Serial2.write(0xff);**
** }**

}

void setup() {
** Serial2.begin(115200);**

** Serial2.print(“baud=115200”);**
** pinMode(LEDPin, OUTPUT);**
** nexInit();**
** h0.attachPop(h0PopCallBack);**
}
void loop() {
** nexLoop(nex_listen_list);**
** // put your main code here, to run repeatedly:**
}

Could anyone provide any guidance of what I’m doing wrong, of if anyone knows any immediate solutions, as it is probably quite a common project (turning LEDs on with an Nextion Screen) but due to my lack of inexperience with Nextion, i’m struggling to make the system cohesive with Arduino

bump

Have a read about how to post your code, and try and explain your problem a bit more concisely - you might then get an answer

BTW - don’t bump ...