Mosfet Dimmer IR controlled (w/Diagram)

I am trying to make a group of LED dim with PWM to a MOSFET. The code seems to work for this, but the trouble is that the IR receiver will only receive the signal to turn on the lights and then IR receivers onboard LED goes to a permanent dim state (which is suppose to be off completely). It then refuses to take input until a Arduino reset is preformed. I purchased another IR receiver and placed it in the same configuration and it work exactly as intended I could brighten the LEDS and I saw the PWM stretch on my oscilloscope with every click of my remote. The trouble is that the receiver quickly quit working at this point I think there is a problem with my circuit. I am attaching the circuit diagram in hopes that someone can help.

Thanks,
Billa

LED1 and LED3 are installed backwards. They can never illuminate as wired.

You should post your code too, be sure use code tags, the </> icon.

It will look look like this: [code] your code here [/code]

Sorry, I think that is just me not being able to get a pinout for that LED on Fritzing (circuit software). I do believe the LEDS are wired correctly though (They will illuminate as currently wired). Here is the code I was using. Also thank you for the help on the formatting there :slight_smile: .

 #include <IRremote.h>

int led = 9;           
int led2 = 10;
int brightness = 0;    // how bright the LED is
const int RECV_PIN = 7; //IR Receiver Pin
IRrecv irrecv(RECV_PIN);
decode_results results;

void setup() {
  // declare pin 9 to be an output:
  pinMode(led, OUTPUT);
  pinMode(led2, OUTPUT);
  Serial.begin(9600);
  irrecv.enableIRIn();
  
}

void loop() {
  
  analogWrite(led, brightness);
  analogWrite(led2, brightness);


  if(irrecv.decode(&results)) //this checks to see if a code has been received
{
    if(results.value == 0xFF906F) //if the button press equals the hex value 0xC284
    {
        Serial.println("Triggered U");
        brightness = brightness + 5;
    }
    
    if(results.value == 0xFFE01F) //if the button press equals the hex value 0xC284
    {
        Serial.println("Triggered D");
        brightness = brightness + 5;
    }
    
    irrecv.resume(); //receive the next value
}

  
  
  delay(100);
}

Does the serial monitor print the 'Triggered U' and the 'Triggered D' ok?

The second
brightness = brightness + 5;
should be
brightness = brightness - 5;

You should restrict the 'brightness' value to 0-255.
Leo..