Programming led fade problems

Hi,
I have made a 4 channel led chaser.
Till function 8 thats gonna be working oke, but when it comes to function 9, i see nothing happend. after some couple of seconds he wil start again with function 1, and thats correct.

I use pin 9, 10, 11 and 12, only pin 12 is or can be fading so i have use SoftPWM.h library so that pin 12 can be fade, and thats working correct when i only when i use this option.
But the fading is not gonna working anny more when i add the other programms.

So now my question, what is the best way to make this 4 channel led chaser to progamm it so, that he can turn on and off, running different programmas and also make some fading options.

This is what i have build: (till 8 it working fine)

#include <SoftPWM.h>  

int sensorPin = A0;    // select the input pin for the potentiometer
int ledPin9 = 9;      // select the pin for the LED
int ledPin10 = 10;      // select the pin for the LED
int ledPin11 = 11;      // select the pin for the LED
int ledPin12 = 12;      // select the pin for the LED
int sensorValue = 0;  // variable to store the value coming from the sensor

void setup() {
  pinMode(ledPin9, OUTPUT);  
  pinMode(ledPin10, OUTPUT);  
  pinMode(ledPin11, OUTPUT);  
  pinMode(ledPin12, OUTPUT);  
  SoftPWMSetFadeTime(ALL, 0, 0); 
}

void loop() {

  
  for(byte i=0;i<4;i++)
  function1();
  
  for(byte i=0;i<4;i++)
  function2();
  
  
  for(byte i=0;i<4;i++)
  function3();
  
  for(byte i=0;i<4;i++)
  function4();
  
  for(byte i=0;i<4;i++)
  function5();
  
  for(byte i=0;i<4;i++)
  function6();
  
    for(byte i=0;i<4;i++)
  function7();
  
      for(byte i=0;i<4;i++)
  function8();
  
        for(byte i=0;i<4;i++)
  function9();
}

void function1()
{ 
  // read the value from the sensor:
  sensorValue = analogRead(sensorPin);    
  // turn the ledPin on
  digitalWrite(ledPin9, HIGH);  
  // stop the program for <sensorValue> milliseconds:
  delay(sensorValue);          
  // turn the ledPin off:        
  digitalWrite(ledPin9, LOW);
  // stop the program for for <sensorValue> milliseconds:
  delay(sensorValue);    
  // read the value from the sensor:
  sensorValue = analogRead(sensorPin);    
  // turn the ledPin on
  digitalWrite(ledPin10, HIGH); 
  // stop the program for <sensorValue> milliseconds:
  delay(sensorValue);          
  // turn the ledPin off:        
  digitalWrite(ledPin10, LOW); 
  // stop the program for for <sensorValue> milliseconds:
  delay(sensorValue); 
  // read the value from the sensor:
  sensorValue = analogRead(sensorPin);    
  // turn the ledPin on
  digitalWrite(ledPin11, HIGH); 
  // stop the program for <sensorValue> milliseconds:
  delay(sensorValue);          
  // turn the ledPin off:        
  digitalWrite(ledPin11, LOW); 
  // stop the program for for <sensorValue> milliseconds:
  delay(sensorValue); 
  // read the value from the sensor:
  sensorValue = analogRead(sensorPin);    
  // turn the ledPin on
  digitalWrite(ledPin12, HIGH); 
  // stop the program for <sensorValue> milliseconds:
  delay(sensorValue);          
  // turn the ledPin off:        
  digitalWrite(ledPin12, LOW); 
  // stop the program for for <sensorValue> milliseconds:
  delay(sensorValue);    
}

void function2()
{
  // read the value from the sensor:
  sensorValue = analogRead(sensorPin);    
  // turn the ledPin on
  digitalWrite(ledPin9, HIGH); 
  delay(150);   
  // turn the ledPin on
  digitalWrite(ledPin10, HIGH);  
  delay(150);     
  // turn the ledPin on
  digitalWrite(ledPin11, HIGH); 
  delay(150);   
  // turn the ledPin on
  digitalWrite(ledPin12, HIGH);    
  delay(150);  
   
  // turn the ledPin off:        
  digitalWrite(ledPin9, LOW); 
  delay(150);    
  // turn the ledPin off:        
  digitalWrite(ledPin10, LOW);   
  delay(150);  
  // turn the ledPin off:        
  digitalWrite(ledPin11, LOW);  
  delay(150);   
  // turn the ledPin off:        
  digitalWrite(ledPin12, LOW);  
   delay(150);     
  // stop the program for for <sensorValue> milliseconds:
  delay(sensorValue);   
}

void function3()
{
  digitalWrite(ledPin9, LOW); 
  digitalWrite(ledPin10, HIGH);  
  digitalWrite(ledPin11, LOW); 
  digitalWrite(ledPin12, HIGH);    
  delay(analogRead(sensorPin)*3+100);  
   
  digitalWrite(ledPin9, HIGH); 
  digitalWrite(ledPin10, LOW);   
  digitalWrite(ledPin11, HIGH);  
  digitalWrite(ledPin12, LOW);  
  delay(analogRead(sensorPin)*3+100);  
}

void function4()
{
  digitalWrite(ledPin9, LOW); 
  digitalWrite(ledPin10, HIGH);  
  digitalWrite(ledPin11, LOW); 
  digitalWrite(ledPin12, HIGH);    
  delay(analogRead(sensorPin)*3+100);  
   
  digitalWrite(ledPin9, HIGH); 
  digitalWrite(ledPin10, LOW);   
  digitalWrite(ledPin11, HIGH);  
  digitalWrite(ledPin12, LOW);  
  delay(analogRead(sensorPin)*3+100);  
  
}  
  
void function5()

{
  // read the value from the sensor:
  sensorValue = analogRead(sensorPin);    
  // turn the ledPin on
  digitalWrite(ledPin12, HIGH); 
  delay(150);   
  // turn the ledPin on
  digitalWrite(ledPin9, HIGH);  
  delay(150);     
  // turn the ledPin on
  digitalWrite(ledPin11, HIGH); 
  delay(150);   
  // turn the ledPin on
  digitalWrite(ledPin10, HIGH);    
  delay(150);  
   
  // turn the ledPin off:        
  digitalWrite(ledPin9, LOW); 
  delay(150);    
  // turn the ledPin off:        
  digitalWrite(ledPin10, LOW);   
  delay(150);  
  // turn the ledPin off:        
  digitalWrite(ledPin11, LOW);  
  delay(150);   
  // turn the ledPin off:        
  digitalWrite(ledPin12, LOW);  
   delay(150);     
  // stop the program for for <sensorValue> milliseconds:
  delay(sensorValue);   
    
}
 

  void function6()
{
  // read the value from the sensor:
  sensorValue = analogRead(sensorPin);    
  // turn the ledPin on
  digitalWrite(ledPin12, HIGH); 
  delay(150);   
  // turn the ledPin on
  digitalWrite(ledPin11, HIGH);  
  delay(150);     
  // turn the ledPin on
  digitalWrite(ledPin10, HIGH); 
  delay(150);   
  // turn the ledPin on
  digitalWrite(ledPin9, HIGH);    
  delay(150);  
   
  // turn the ledPin off:        
  digitalWrite(ledPin9, LOW); 
  delay(150);    
  // turn the ledPin off:        
  digitalWrite(ledPin10, LOW);   
  delay(150);  
  // turn the ledPin off:        
  digitalWrite(ledPin11, LOW);  
  delay(150);   
  // turn the ledPin off:        
  digitalWrite(ledPin12, LOW);  
   delay(150);     
  // stop the program for for <sensorValue> milliseconds:
  delay(sensorValue);   
}

 void function7()
{
  // read the value from the sensor:
  sensorValue = analogRead(sensorPin);    
  // turn the ledPin on
  digitalWrite(ledPin9, HIGH); 
  delay(150);   
  // turn the ledPin on
  digitalWrite(ledPin10, HIGH);  
  delay(150);     
  // turn the ledPin on
  digitalWrite(ledPin11, HIGH); 
  delay(150);   
  // turn the ledPin on
  digitalWrite(ledPin12, HIGH);    
  delay(150);  
   
  // turn the ledPin off:        
  digitalWrite(ledPin12, LOW); 
  delay(150);    
  // turn the ledPin off:        
  digitalWrite(ledPin11, LOW);   
  delay(150);  
  // turn the ledPin off:        
  digitalWrite(ledPin10, LOW);  
  delay(150);   
  // turn the ledPin off:        
  digitalWrite(ledPin9, LOW);  
   delay(150);     
  // stop the program for for <sensorValue> milliseconds:
  delay(sensorValue);   
}

 void function8()
{
  digitalWrite(12,HIGH);
  delay(100);
  digitalWrite(12,LOW);
 delay(25);
  digitalWrite(11,HIGH);
  delay(100);
  digitalWrite(11,LOW);
 delay(25);
  digitalWrite(10,HIGH);
  delay(100);
  digitalWrite(10,LOW);
 delay(25);
  digitalWrite(9,HIGH);
  delay(100);
  digitalWrite(9,LOW);
 delay(25);

}

 void function9()
{   
  // Turn on - Fade led on pin12 up and fade it down  
  SoftPWMSet(12, 255);      // Wait for LED to turn on - you could do other tasks here   
  delay(900);      // Turn off - set to 0%   
  SoftPWMSet(12, 0);      // Wait for LED to turn off   
  delay(900); 
}

I use pin 9, 10, 11 and 12, only pin 12 is or can be fading

Why? You are using SoftPWM to do PWM on the only pin in the set that can’t do hardware PWM. Why?

Your function9() does nothing more than, apparently, turn the pin full on or full off. I don’t see the purpose of using SoftPWM to do that.

wel, tis is working fine:

#include <SoftPWM.h>

void setup(){  
// Initialize  
SoftPWMBegin();  
// Create and set pin 12 to 0 (off)  
SoftPWMSet(12, 0);  
// Set fade time for pin 12 to 100 ms fade-up time, and 500 ms fade-down time  
SoftPWMSetFadeTime(12, 100, 500);}void loop(){  

// Turn on - set to 100%  
SoftPWMSetPercent(12, 100);  

// Wait for LED to turn on - you could do other tasks here  
delay(100);  

// Turn off - set to 0%  
SoftPWMSetPercent(12, 0);  

// Wait for LED to turn off  
delay(500);}

So what i try to do is running different programs within this programs a program with fade.
Maybe there is a other way?

Use more pins, but this is a example with pin 12 in it

wel, tis is working fine:

That's doing far more than you are doing in the other sketch.

SoftPWMSetFadeTime(12, 100, 500);}void loop(){

This is wrong in so many ways...

Yeahh, i know, sorry for that, i think forgot space/enter by typing it, that must be:

SoftPWMSetFadeTime(12, 100, 500);
}

void loop()
{

But thanks for helping me, i learn a must more for know :~

I'll check further