{"id":22345078,"url":"https://github.com/seeed-studio/seeed_arduino_rotaryencoder","last_synced_at":"2026-02-25T19:12:27.811Z","repository":{"id":126521206,"uuid":"224628680","full_name":"Seeed-Studio/Seeed_Arduino_RotaryEncoder","owner":"Seeed-Studio","description":"This RotaryEncoder Library gives an example to control the Grove Encoder and create the callback function.","archived":false,"fork":false,"pushed_at":"2025-01-08T08:16:33.000Z","size":22,"stargazers_count":1,"open_issues_count":0,"forks_count":2,"subscribers_count":13,"default_branch":"master","last_synced_at":"2025-04-07T11:23:33.289Z","etag":null,"topics":["arduino","arduino-library","grove","rotaryencoder"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Seeed-Studio.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","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":"2019-11-28T10:30:56.000Z","updated_at":"2025-01-08T08:16:36.000Z","dependencies_parsed_at":null,"dependency_job_id":"860bc9d5-5421-479d-a7f6-cd2a54e77a62","html_url":"https://github.com/Seeed-Studio/Seeed_Arduino_RotaryEncoder","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/Seeed-Studio/Seeed_Arduino_RotaryEncoder","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Seeed-Studio%2FSeeed_Arduino_RotaryEncoder","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Seeed-Studio%2FSeeed_Arduino_RotaryEncoder/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Seeed-Studio%2FSeeed_Arduino_RotaryEncoder/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Seeed-Studio%2FSeeed_Arduino_RotaryEncoder/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Seeed-Studio","download_url":"https://codeload.github.com/Seeed-Studio/Seeed_Arduino_RotaryEncoder/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Seeed-Studio%2FSeeed_Arduino_RotaryEncoder/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279020354,"owners_count":26086866,"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","status":"online","status_checked_at":"2025-10-14T02:00:06.444Z","response_time":60,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["arduino","arduino-library","grove","rotaryencoder"],"created_at":"2024-12-04T09:16:21.497Z","updated_at":"2025-10-14T18:31:55.749Z","avatar_url":"https://github.com/Seeed-Studio.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Seeed_Arduino_RotaryEncoder  [![Build Status](https://travis-ci.com/Seeed-Studio/Seeed_Arduino_RotaryEncoder.svg?branch=master)](https://travis-ci.com/Seeed-Studio/Seeed_Arduino_RotaryEncoder)\n\n### Introduction\n\nThis library support Encoder.\n\nConnect the Encoder to the D2 and D3 pins of the motherboard.You can use other pins if you want.\n\n###  Usage\n\n   1.git clone this resp to your Arduino IDE'S libraries directory.\n\n   2.Run the demo \"encoderTest\" on examples directory.\n\n### Software usage  \n\n- Install Seeed Arduino RotaryEncoder library to Arduino.  \n\n- Start a project.  \n\n- Create the callback function and set the Encoder pin.(just set SIGA.SIGB pin is equal to SIGA pin plus 1.)\n\n   Usage of the library, see Example encoderTest\n   \n   1. Add headers\n   ```\n      #include \"GroveEncoder.h\"\n   ```\n   2. Create the callback function.The callback function gets the current Angle and the status of the button press.\n   Define a 'value' to determine whether the Angle value has changed.Define a 'bt_flag' to prevent the button value from being read    more than once.And set 'bt flag' to 1 in the while() function.You can also get the Angle value through the getValue() function.\n   ```\n      int value = 0;\n      int bt_flag = 0;\n      void myCallback(int newValue, bool flag) {\n        if(value != newValue)\n        {\n          value = newValue;\n          Serial.print(newValue, HEX);\n          Serial.print(\"\\n\");\n        }\n        if(flag \u0026\u0026 bt_flag)\n        {\n          Serial.println(\"button\");\n          bt_flag = 0;\n        }\n      }\n   ```\n   ```\n        while(1)\n        {\n          Serial.println(myEncoder.getValue());\n          delay(100);\n          bt_flag = 1;\n        }\n   ```\n\n   3. Initialize the Encoder.The parameters are the SIGA pin and the callback function name, respectively.\n   \n   ```\n      GroveEncoder myEncoder(2, \u0026myCallback);\n   ```\n   \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fseeed-studio%2Fseeed_arduino_rotaryencoder","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fseeed-studio%2Fseeed_arduino_rotaryencoder","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fseeed-studio%2Fseeed_arduino_rotaryencoder/lists"}