{"id":16389534,"url":"https://github.com/mnishiguchi/servo_kit","last_synced_at":"2025-03-23T04:31:38.049Z","repository":{"id":46728531,"uuid":"324879465","full_name":"mnishiguchi/servo_kit","owner":"mnishiguchi","description":"Use PCA9685 PWM/Servo Controller in Elixir","archived":false,"fork":false,"pushed_at":"2021-09-28T05:09:59.000Z","size":75,"stargazers_count":6,"open_issues_count":3,"forks_count":4,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-10-30T21:39:12.683Z","etag":null,"topics":["elixir","nerves","pca9685","pwm","servo-controller"],"latest_commit_sha":null,"homepage":"https://dev.to/mnishiguchi/controlling-servo-in-elixir-nerves-h47","language":"Elixir","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mnishiguchi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-12-28T01:00:22.000Z","updated_at":"2022-05-31T20:01:56.000Z","dependencies_parsed_at":"2022-07-22T10:48:14.849Z","dependency_job_id":null,"html_url":"https://github.com/mnishiguchi/servo_kit","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mnishiguchi%2Fservo_kit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mnishiguchi%2Fservo_kit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mnishiguchi%2Fservo_kit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mnishiguchi%2Fservo_kit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mnishiguchi","download_url":"https://codeload.github.com/mnishiguchi/servo_kit/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245056889,"owners_count":20553855,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["elixir","nerves","pca9685","pwm","servo-controller"],"created_at":"2024-10-11T04:33:29.796Z","updated_at":"2025-03-23T04:31:37.695Z","avatar_url":"https://github.com/mnishiguchi.png","language":"Elixir","readme":"# ServoKit\n\n[![Hex.pm](https://img.shields.io/hexpm/v/servo_kit.svg)](https://hex.pm/packages/servo_kit)\n[![API docs](https://img.shields.io/hexpm/v/servo_kit.svg?label=docs)](https://hexdocs.pm/servo_kit)\n![CI](https://github.com/mnishiguchi/pca9685/workflows/CI/badge.svg)\n\nUse PCA9685 PWM/Servo Controller in Elixir\n\n## Examples\n\n### Basic usage\n\n```elixir\n{:ok, _pid} = ServoKit.start_link()\n\n# Set the duty cycle to 7.5% for Channel 0\nServoKit.set_pwm_duty_cycle(7.5, ch: 0)\n```\n\n### Controling a standard servo\n\n```elixir\nServoKit.start_link()\n\n# Define the mapping between the angle in degrees and duty cycle in percentage\nangle_range = {0, 180}\nduty_cycle_range = {2.5, 12.5}\n\n# Set the angle to 0 degree for channel 0\n0 |\u003e ServoKit.map(angle_range, duty_cycle_range) |\u003e ServoKit.set_pwm_duty_cycle(ch: 0)\n\n# Set the angle to 90 degree for channel 0\n90 |\u003e ServoKit.map(angle_range, duty_cycle_range) |\u003e ServoKit.set_pwm_duty_cycle(ch: 0)\n\n# Set the angle to 180 degree for channel 0\n180 |\u003e ServoKit.map(angle_range, duty_cycle_range) |\u003e ServoKit.set_pwm_duty_cycle(ch: 0)\n```\n\n### Controling a continuous servo\n\n```elixir\nServoKit.start_link()\n\n# Define the mapping between the throttle -1..1 and duty cycle in percentage\nthrottle_range = {-1.0, 1.0}\nduty_cycle_range = {2.5, 12.5}\n\n# Stop the actuator for channel 0\n0 |\u003e ServoKit.map(throttle_range, duty_cycle_range) |\u003e ServoKit.set_pwm_duty_cycle(ch: 0)\n\n# Throttle full speed forward for channel 0\n1.0 |\u003e ServoKit.map(throttle_range, duty_cycle_range) |\u003e ServoKit.set_pwm_duty_cycle(ch: 0)\n\n# Throttle full speed reverse for channel 0\n-1.0 |\u003e ServoKit.map(throttle_range, duty_cycle_range) |\u003e ServoKit.set_pwm_duty_cycle(ch: 0)\n```\n\n## Links\n\n- [PCA9685 Overview](https://www.nxp.com/products/power-management/lighting-driver-and-controller-ics/ic-led-controllers/16-channel-12-bit-pwm-fm-plus-ic-bus-led-controller:PCA9685)\n- [PCA9685 Data Sheet](https://cdn-shop.adafruit.com/datasheets/PCA9685.pdf)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmnishiguchi%2Fservo_kit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmnishiguchi%2Fservo_kit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmnishiguchi%2Fservo_kit/lists"}