# Servo2040 Robot control(leg)

**URL:** <https://forums.pimoroni.com/t/servo2040-robot-control-leg/28488>\
**Category:** Support\
**Created:** [November 20, 2025, 6:29pm UTC](https://forums.pimoroni.com/t/servo2040-robot-control-leg/28488 "2025-11-20T18:29:36Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![robotkiller](https://avatars.discourse-cdn.com/v4/letter/r/4da419/32.png) [@robotkiller](https://forums.pimoroni.com/u/robotkiller)\
**Post date:** [November 20, 2025, 6:29pm UTC](https://forums.pimoroni.com/t/servo2040-robot-control-leg/28488/1 "2025-11-20T18:29:36Z")

</div>

Hello. I downloaded the **pico-v1.25.0-pimoroni-micropython.uf2** file to control the legs of my hexapod robot, and I connected it using Thonny. However, I’m getting an error saying that the **servo2040** library cannot be found. I’m not sure what is causing this problem.

Here is my environment:

- **OS:** Linux

- **Hardware:** Raspberry Pi 5

- I am writing and running the code through Thonny on the Raspberry Pi.

Additionally, when I connect the Servo 2040 board, the motors do not show the expected rainbow-colored LED effect.

There is another issue: I followed the exact hardware setup from the YouTuber **“Make Your Pet,”** and the Android-based pre-made app is able to control the robot successfully. But when I try to control the motors through **my own code using Servo 2040** , it does not connect at all — which is the main problem I’m trying to solve.

 ![1](https://us1.discourse-cdn.com/flex016/uploads/pimoroni/original/2X/1/1f3633a13f201fd54a59ea2e08668505a4792968.jpeg)

---

<div class="post-metadata">

**Author:** ![alphanumeric](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/alphanumeric/32/2729_2.png) [@alphanumeric](https://forums.pimoroni.com/u/alphanumeric)\
**Post date:** [November 21, 2025, 9:05am UTC](https://forums.pimoroni.com/t/servo2040-robot-control-leg/28488/2 "2025-11-21T09:05:01Z")

</div>

Typo in line 2 maybe? the error message is saying “no module named servo **i** ”

---

<div class="post-metadata">

**Author:** ![Anabaric](https://avatars.discourse-cdn.com/v4/letter/a/9fc29f/32.png) [@Anabaric](https://forums.pimoroni.com/u/Anabaric)\
**Post date:** [April 28, 2026, 8:19am UTC](https://forums.pimoroni.com/t/servo2040-robot-control-leg/28488/3 "2026-04-28T08:19:31Z")

</div>

Looks like you had an error in the import code.

> from servo import Servo, servo2040
> 
> #Create a servo on pin 0
> 
> s = Servo(servo2040.SERVO\_1)
> 
> #Enable the servo (this puts it at the middle)
> 
> s.enable()  
> time.sleep(2)

There are more examples here:

> **[pimoroni-pico/micropython/examples/servo2040 at main · pimoroni/pimoroni-pico](https://github.com/pimoroni/pimoroni-pico/tree/main/micropython/examples/servo2040)**
>
> main/micropython/examples/servo2040
