Set absolute value for motor?


Hi! I have a motor connected to a Lego rope winch. When I just connect an input device to the motors speed I will run into problems when the cable is completely drawn in.

What I need is either a limiter that kicks in or, better, a way to contral an absolute rotation. Like 0 is completely drawn in and 1000 when it’s lowered. Then my kids can just use a slider or dial to control it.

So I need to find a way to define the start and endpoint somehow. Any ideas? Thank you!


Are you controlling it with Rockpool, or Python?

Figuring out how far a motor has turned is usually accomplished with an encoder which physically measures the rotations. Unfortunately there’s no such concept in Flotilla at the moment, so the motors don’t lend themselves well to accurate positioning.

What you need is a time-based solution, which is rough but may well get the job done if we make a few assumptions.

You’ll need to set a constant speed, and time how long it takes for the winch to wind up/down.

Playing back something at a constant speed for a fixed length of time is easy enough in Python, but potentially pretty tricky in Rockpool!

Anyway, this is an interesting question, and doing “X thing” for “Y amount of time” may be a very common task that we could potentially make sure Rockpool is capable of performing- within limits of course.


We’re using rockpool, as my kids are to young for code. But I think I’ll have to switch to something else than rockpool anyway, mainly because it’s lack of a way to save programs for future use.

(In the beginning I hoped we could assemble the programs für our small projects in rockpool and just grab those snippets back in if the kids want to rebuild something later.)


Save/Load functionality is a work in progress. It’s not had much attention yet, but it’s definitely closer to being functional than it was.

We’re also keen to get Scratch… up to scratch… which may be the best avenue for you when it’s available.