// For: https://forum.arduino.cc/t/something-as-8led-snake/1039552
// Using the SoftPWM library: https://github.com/bhagman/SoftPWM
// There is a other one: https://github.com/Palatis/arduino-softpwm
//

#include <SoftPWM.h>

void setup()
{
  SoftPWMBegin();

  for (int i = 2; i <= 9; i++)         // pin 2 up to 9
    SoftPWMSet(i, 0);

  SoftPWMSetFadeTime(ALL, 50, 100);
}

void loop()
{
  for (int i=2; i<9; i++)
  {
    SoftPWMSet(i, 255);
    delay(100);
    SoftPWMSet(i, 0);
  }
  for (int i=9; i>=2; i--)
  {
    SoftPWMSet(i, 255);
    delay(100);
    SoftPWMSet(i, 0);
  }
}