He all.

In the past there was a code for the Expression1. It called Adv Smoother.

Code E1:

```
n@Advanced_Smoother
i@Target Speed Acceleration
o@Value Active
# Activate when target has been set
~Target -> Active = 1;
# Main computation loop
first() | clk() ->
# Precomputation of inputs
!Acceleration -> Acceleration = Speed * 50 * 2;
AccLength = Speed^2 / Acceleration / 2
AccRate = min(Speed, Acceleration / 50)
# Precomputation of variables
Distance = Target - Value
Direction = Distance >= 0 ? 1 : -1
# Calculate ideal speed modifier
IdealRate = Speed * Direction
abs(Distance) <= AccLength ->
IdealRate *= sqrt(abs(Distance - Rate / 50) / AccLength);
# Calculate final speed for iteration
Rate += clamp(IdealRate - Rate, -Acceleration / 50, Acceleration / 50)
Value += Rate / 50
# Check if value has reached target
Active = abs(Rate) > AccRate
| abs(Distance) > AccRate / 50
!Active -> Rate = 0, Value = Target;;
# Schedule the main loop if active
Active -> interval(20);
```

Because E1 no longer exists i want to make it E2

Well…

Code E2:

```
@name Advanced Smoother
@inputs Target Speed Acceleration
@outputs Value Active
@persist AccRate AccLength Distance Direction Rate IdealRate
# Activate when target has been set
Active=(Target ? 1 : 0)
# Main computation loop
if(first() | clk()){
# Precomputation of inputs
if(!Acceleration){
Acceleration = Speed * 50 * 2
AccLength = Speed^2 / Acceleration / 2
AccRate = min(Speed, Acceleration / 50)
}
# Precomputation of variables
Distance = Target - Value
Direction = (Distance >= 0 ? 1 : -1)
# Calculate ideal speed modifier
IdealRate = Speed * Direction
if(abs(Distance) <= AccLength){
IdealRate *= sqrt(abs(Distance - Rate / 50) / AccLength)
}
# Calculate final speed for iteration
Rate += clamp(IdealRate - Rate, -Acceleration / 50, Acceleration / 50)
Value += Rate / 50
# Check if value has reached target
Active = ((abs(Rate) > AccRate)|(abs(Distance) > AccRate / 50))
if(!Active){
Rate = 0
Value = Target
}
}
# Schedule the main loop if active
if(Active==1){interval(20)}
```

Well the code worked so far.

But the only thing is that the hydrolics don’t stop!

if the target is 50 then it swings between 40 and 60.

It don’t stop.

if the target is 0 its the same.!

Can someone help me?