Skip to content

Add example for servo motor via PWM#140

Open
Skipper7718 wants to merge 3 commits intoraspberrypi:developfrom
Skipper7718:feature
Open

Add example for servo motor via PWM#140
Skipper7718 wants to merge 3 commits intoraspberrypi:developfrom
Skipper7718:feature

Conversation

@Skipper7718
Copy link
Copy Markdown
Contributor

Servo motor example

This example is an adapted version of the Micropython repository to be used easily in C.

@Skipper7718 Skipper7718 changed the title added servo example Add example for servo motor via PWM Jul 12, 2021
Comment on lines +36 to +37
uint32_t source_hz = clock_get_hz(clk_sys);
uint freq = 50;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inconsistent indentation.

sleep_ms(1000);
}

void servo_init(int gpio, int base_frequency)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This base_frequency parameter doesn't seem to actually be used anywhere??

Comment on lines +25 to +26
if(wait_write)
sleep_ms(1000);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is documented as "@param wait_write Wait for write to finish", in which case 1000ms seems like an excessively long time? 🤷

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My motors are slow and with a smaller delay my motor do not finish the turn properly

@kilograham kilograham added this to the 2.2.0 milestone Feb 13, 2025
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.

4 participants