Quantcast
Channel: MakerWorld - Bambu Lab Community Forum
Viewing all articles
Browse latest Browse all 2595

Code for moving angular servo at specific speed

$
0
0

I’ve been tearing my hair out trying to write a code block that will move an angular servo to a specific angle at a specific speed. I need it so I can trigger the movement after a delay to avoid moving parts clashing.

This is what I’ve been working with, based on the documentation, picking my friends brains (who know a bit of python) and even stooping so low as to use ChatGPT (sad face).

import time
import machine
from bbl.servos import ServosController 

servos = ServosController()

servos.set_angle_stepping(2, 90, 10)

def proc(t):
    servos.timing_proc() 
tim = machine.Timer(0) 
tim.init(period.10, mode=Timer.PERIODIC, callback.proc) 

while servos.servos_info_map[0]["step_en"]: 
    time.sleep(0.05) 

tim.deinit()

I know I’m doing something stupid, I just can’t figure out what so would massively appreciate any help

15 posts - 2 participants

Read full topic


Viewing all articles
Browse latest Browse all 2595

Trending Articles