{"id":20563403,"url":"https://github.com/pilotak/movingaverage","last_synced_at":"2025-07-21T12:02:39.971Z","repository":{"id":91903420,"uuid":"115129947","full_name":"pilotak/MovingAverage","owner":"pilotak","description":"Arduino \u0026 Mbed Library for averaging fixed-point numbers ","archived":false,"fork":false,"pushed_at":"2024-10-11T07:42:25.000Z","size":37,"stargazers_count":3,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-14T14:57:20.175Z","etag":null,"topics":["arduino","arduino-library","averaging-filter","filter","mbed","mbed-os","moving-average"],"latest_commit_sha":null,"homepage":"","language":"C++","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/pilotak.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2017-12-22T15:59:58.000Z","updated_at":"2024-10-11T07:41:35.000Z","dependencies_parsed_at":"2024-03-16T18:18:09.338Z","dependency_job_id":"21d89e1e-c58c-47fe-9b53-db1d06601419","html_url":"https://github.com/pilotak/MovingAverage","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/pilotak/MovingAverage","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pilotak%2FMovingAverage","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pilotak%2FMovingAverage/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pilotak%2FMovingAverage/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pilotak%2FMovingAverage/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pilotak","download_url":"https://codeload.github.com/pilotak/MovingAverage/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pilotak%2FMovingAverage/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266296760,"owners_count":23907012,"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-07-21T11:47:31.412Z","response_time":64,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"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","averaging-filter","filter","mbed","mbed-os","moving-average"],"created_at":"2024-11-16T04:18:21.848Z","updated_at":"2025-07-21T12:02:39.950Z","avatar_url":"https://github.com/pilotak.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Moving average filter\n[![build](https://github.com/pilotak/MovingAverage/workflows/build/badge.svg)](https://github.com/pilotak/MovingAverage/actions) \n[![Framework Badge Arduino](https://img.shields.io/badge/framework-arduino-00979C.svg)](https://arduino.cc)\n[![Framework Badge mbed](https://img.shields.io/badge/framework-mbed-008fbe.svg)](https://os.mbed.com/)\n\n\n**_Buffer_** type can be:\n - `uint8_t` or `int8_t` with maximum buffer length of **16843009**\n - `uint16_t` or `int16_t` with maximum buffer length of **65537**\n - `uint32_t` or `int32_t` but added number can be as long as 30 bits which eaquals to maximum buffer length of **2**, 29 bits number = max buffer length of **4**, etc.\n\n**_Buffer length_**:\n- power of 2 only: 2, 4, 8, 16, 32, 64, 128, etc.\n\n## Arduino example\nPlease see `examples` folder\n\n## Mbed example\n```cpp\n#include \"mbed.h\"\n#include \"MovingAverage.h\"\n\n// Buffer (and added samples) will be initialised as uint8_t, total 16 samples\nMovingAverage \u003cuint8_t, 16\u003e filter;\n\nint main() {\n    printf(\"result: %u\\n\", filter.add(255)); // insert new number and get result\n    printf(\"result: %u\\n\", filter.add(6));   // insert new number and get result\n    printf(\"result: %u\\n\", filter.add(9));   // insert new number and get result\n    printf(\"result: %u\\n\", filter.get());    // get last result, without adding a newone\n\n    return 0;\n}\n```\n\n### Output\n\u003e result: 255\n\u003e \n\u003e result: 239\n\u003e \n\u003e result: 224\n\u003e \n\u003e result: 224\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpilotak%2Fmovingaverage","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpilotak%2Fmovingaverage","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpilotak%2Fmovingaverage/lists"}