when I go with k=i in for loop, only first 2 servos will move and the rest won't react but if i change so that k will be constant (for example k=1) every servo will go. Problem happens for k>=2. Does anyone had same issue or know what maybe a solution?
The problem is that only first 2 declared servos are reacting no matter what. For example if I go with s[0].attach(6) servo will work but s[3].attach(6) won't.
Yes, a wiring diagram will help us help you.
Get out a pencil and paper, show how things are attached, take a picture of it and post it here.
While you have your camera out, snap a picture of your project and post that too.
So I checked everything as you said and what I found using Serial.print(s*.attached()) that for some reason only servos 0 and 1 are attached. Before you ask i have updated servo library. I'm arduino nano expansion board so it maybe power supply issue but I doubt that. Can it be like that because of me using arduino nano with Atmega168?*
Servo motors have three wires: power, ground, and signal. The power wire is typically red, and should be connected to the 5V pin on the Arduino board. The ground wire is typically black or brown and should be connected to a ground pin on the Arduino board. The signal pin is typically yellow, orange or white and should be connected to a digital pin on the Arduino board. Note that servos draw considerable power, so if you need to drive more than one or two, you'll probably need to power them from a separate supply (i.e. not the +5V pin on your Arduino). Be sure to connect the grounds of the Arduino and external power supply together.
@flamaster, you say that you modified the servo library.
Can you post that code?
Where did you get the servo library that you started from? Do you still have that is its original form? Attach that as well.