bbcmicrobit / bbcmicrobit/micropython

PWM Help

Open
#354 9 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
C
Stars
646
Forks
290
PR merge metrics
No merged PRs in 30d

Description

OK bare with me here please chaps as i'm on the edge of my understanding and am trying to learn :-)

I've read this https://microbit-micropython.readthedocs.io/en/latest/pin.html and been looking at the Mbed C IO section https://lancaster-university.github.io/microbit-docs/ubit/io/

I'm trying to build a camera gimbal and have a really rough prototype running but would like to fine tune it a lot more. At the moments i'm getting the X axis and then trying to convert it accross to a value that wil give an appropraite counter adjustment and write it back to the analog pin0. This is ok but it's a vaule between 0 and 1023 for 0% - 100% on PWM. The servo I'm currently playing with has a 180d rotation with a PWM period of 20 and a range of 550uSec to 2250uSec with 1500uSec being in the middle. Looking at the DAL IO There seems to be a functoib setServoValue that alows me to use a value between 0 and 180 (500 - 2500uSec) directly. Are these functions available via Python or am i mussunderstanding somthing along the way.

Any help appreciated.

Thanks
Damian

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.