allows you to control one or more pistons
indexing of pistons goes from 0 to (getPistonsCount() - 1)
component name - pistonController

methods:

            local pistonController = getComponent("pistonController")
local speed = 3
local height = 4

function onTick(dt)
    local tick = getUptime() * speed
    for i = 0, pistonController.getPistonsCount() - 1 do
        pistonController.setLength(i, ((math.sin(math.rad(tick - (i * 16))) + 1) / 2) * height)
        pistonController.setVelocity(i, pistonController.getMaxVelocity(i))
    end
end

_enableCallbacks = true
            
        
            local p1 = getComponentByLabel("pistonController", "1")
local p2 = getComponentByLabel("pistonController", "2")

function onTick(dt)
    local state = getTick() % 40 >= 20
    p1.setVelocity(0, p1.getMaxVelocity(0))
    p2.setVelocity(0, p2.getMaxVelocity(0))
    p1.setLength(0, state and 4 or 0)
    p2.setLength(0, state and 0 or 4)
end

_enableCallbacks = true