Skip to content

arduino-uno: simple-servo example #628

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

ddaniel27
Copy link

Hey, first, thanks for this repo! I'm a rust beginner and to be honest I want to use it for some embedded programming hobby, no professional use right now. So I will be really happy to get some honest feedback about this code.

I know there is a lot of unsafe blocks, so it will be great if you can point some ways to deal with that, improve the code or anything honestly. Basically I just read the official arduino servo library where uses interruptions to update the servos when needed. I translate most of the code and after a lot of frustration, I ended with this code that allows the user to create a servo, attach it and set some angles in a very simple way.

Let me know if more info or changes are needed.

@kbleeke
Copy link

kbleeke commented Apr 18, 2025

I am in a similar situation that I want to control some servos for a hobby project. I have Rust experience, although not much on embedded.

Some initial API feedback: I think any servo controller has to somehow take ownership of TC1. This seems to be the idea behind most things in embedded Rust that to use a resource, you have to pass the peripheral handle. As the timers on the atmega328p are all share the timer and pwm modes, we have to exclusively reserve this timer for the serve control and disallow the creation of e.g. Timer1Pwm at the same time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants