{"id":19138016,"url":"https://github.com/lemonpi/wheelencoders","last_synced_at":"2025-07-31T04:35:34.001Z","repository":{"id":73436212,"uuid":"109047207","full_name":"LemonPi/WheelEncoders","owner":"LemonPi","description":"Arduino library for 2 wheel encoders (rotary or optical)","archived":false,"fork":false,"pushed_at":"2017-10-31T20:11:01.000Z","size":1,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-03T13:52:22.990Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/LemonPi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-10-31T20:10:44.000Z","updated_at":"2017-10-31T20:11:02.000Z","dependencies_parsed_at":null,"dependency_job_id":"f4f96272-7bc6-45b8-b5ec-980867eaa945","html_url":"https://github.com/LemonPi/WheelEncoders","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LemonPi%2FWheelEncoders","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LemonPi%2FWheelEncoders/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LemonPi%2FWheelEncoders/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LemonPi%2FWheelEncoders/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/LemonPi","download_url":"https://codeload.github.com/LemonPi/WheelEncoders/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240217173,"owners_count":19766723,"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":[],"created_at":"2024-11-09T06:41:27.799Z","updated_at":"2025-02-22T18:27:27.569Z","avatar_url":"https://github.com/LemonPi.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Arduino library for encoders (rotary or optical) for two wheels\n\nTwo ways to use this:\n1. Drop directory directly inside sketch\n\nor\n\n1. Move directory under Arudino libraries directory\n2. In Arduino IDE with sketch open select Sketch \u003e Include Library \u003e WheelEncoder (should be under Contributed Libraries)\n\n## Usage\n\n```c++\n#include \u003cArduino.h\u003e\n#include \"WheelEncoders.h\"\n\n// pins 2 and 3 are outputs from the encoder into the Arduino\n// these are special Arduino pins (for Uno and Mega, other platforms may have different)\n// see https://www.arduino.cc/en/Reference/AttachInterrupt for the interrupt pins\nconstexpr auto LEFT_INTERRUPT_PIN = 2;\nconstexpr auto RIGHT_INTERRUPT_PIN = 3;\n\n\nvoid setup() {\n\tWheelEncoders::setUp(LEFT_INTERRUPT_PIN, RIGHT_INTERRUPT_PIN);\n    // for printing out the ticks\n    Serial.begin(9600);\n}\n\nvoid loop() {\n    // retrieve instantaneous ticks because ticks could occur during code execution\n    const auto leftTicks = WheelEncoders::getLeftTicks();\n    const auto rightTicks = WheelEncoders::getRightTicks();\n    // when either tick is above a certain amount\n    if (leftTicks \u003e 1000 || rightTicks \u003e 1000) {\n        // reset ticks so we start accumulating from 0 for both sides\n        WheelEncoders::clear();\n    }\n\n    // print through serial\n    Serial.print(leftTicks);\n    Serial.print(\" \");\n    Serial.println(rightTicks);\n\n    // wait a second for next print\n    // note that interrupts are triggered even when we're waiting\n    delay(1000);\n}\n```\n\n## Limitations\n- Calling `setUp` occupies two interrupt pins\n- Variable names and 2 encoders most suitable for a differentially steered robot","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flemonpi%2Fwheelencoders","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flemonpi%2Fwheelencoders","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flemonpi%2Fwheelencoders/lists"}