SoftPWM code confusion for RGB leds and pirs

Hi All,
I am confused about how to code softpwm. I am in over my head. Looking at tutorials I am confused with non softpwm and softpwn coding.
I need some code for 4 RGB Led Strips with 4 pir (one per stip). Each led strip independent of the other. At this time only need LED On and Off. Will add fading some other time. At this time I have leds on 0-11 and I was going to have pir on A0-A3

I have the 12 mosfet 3 per strip working. With single leds at the time will connect the strip after code is working.


Sorry I am new to the forum and arduino.

Yes I understand the code will become more complex or change all togather.

Was using code

int LEDArray[] = {5, 6, 9, 10};           // LED array for PWM 5,6,9 and 10
int numOfLEDs = 4;                       // LEDs of index 0-3
int pirState = LOW;
int pirVal = 0;
int pirPin = 12;

void setup()  {
  pinMode(pirPin, INPUT);
  int i;
  for(i = 0; i < numOfLEDs; i++) {
    pinMode(LEDArray[i], OUTPUT);

void loop()  {
  pirVal = digitalRead(pirPin);
  int i;
  //if motion is captured, light the LEDs in sequence
  if (pirVal == HIGH) {
  for (i= 0; i < numOfLEDs; i++) {
    analogWrite(LEDArray[i], 255);
    delay (1000);
  delay (1000);
   for (i= 0; i < numOfLEDs; i++) {
    analogWrite(LEDArray[i], 0);
    delay (1000);
  if (pirState == LOW) {
      pirState = HIGH;
  //else, set all LED values to zero
  else {
    analogWrite(LEDArray[0], 0);
    analogWrite(LEDArray[1], 0);
    analogWrite(LEDArray[2], 0);
    analogWrite(LEDArray[3], 0);
    if (pirState == HIGH) {
      pirState = LOW;

OK, sorted. Sorry, I am not into the softpwm at this point, but it helps others.

Thank Paul_B Did not see that about adding code. I know it will change. It is not in softpwm code, and I do not have all 12 outputs or 4 inputs.

I have used the PWM on the arduino for my 1st step in setting up the RGB strip, I know the mosfet and leds is side working.

But coding is not my strong point. Soooo I ask people who know.

There are of course hardware alternatives to using soft PWM when you need more PWM outputs than your Arduino can provide such as addressable LEDs, MCUs with more hardware PWM, or some of the ICs frequently discussed here but there are times when a software solution is useful. I have tried quite a few different soft PWM libraries and example sketches and my favorite is I have a fork of that library that allows the PWM channels to be configured for most common boards using the Arduino pin numbers instead of the AVR port/bit which is a bit more beginner friendly:

Sorry still lost.