{"id":21561049,"url":"https://github.com/end2endzone/win32arduino","last_synced_at":"2026-05-14T21:34:00.352Z","repository":{"id":135365916,"uuid":"119910335","full_name":"end2endzone/win32Arduino","owner":"end2endzone","description":"win32Arduino is a windows/linux implementation of many arduino functions to allow an arduino library developer to unit test code outside of the arduino platform.","archived":false,"fork":false,"pushed_at":"2021-04-05T20:41:41.000Z","size":1040,"stargazers_count":2,"open_issues_count":5,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-10-18T20:40:51.544Z","etag":null,"topics":["arduino","cross-platform","multi-platform","unit-test"],"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/end2endzone.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGES","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":"AUTHORS","dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-02-02T00:26:05.000Z","updated_at":"2021-04-05T20:33:34.000Z","dependencies_parsed_at":"2023-04-12T09:47:09.047Z","dependency_job_id":null,"html_url":"https://github.com/end2endzone/win32Arduino","commit_stats":null,"previous_names":[],"tags_count":20,"template":false,"template_full_name":null,"purl":"pkg:github/end2endzone/win32Arduino","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/end2endzone%2Fwin32Arduino","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/end2endzone%2Fwin32Arduino/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/end2endzone%2Fwin32Arduino/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/end2endzone%2Fwin32Arduino/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/end2endzone","download_url":"https://codeload.github.com/end2endzone/win32Arduino/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/end2endzone%2Fwin32Arduino/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33044178,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-13T13:14:54.681Z","status":"online","status_checked_at":"2026-05-14T02:00:06.663Z","response_time":57,"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","cross-platform","multi-platform","unit-test"],"created_at":"2024-11-24T09:18:37.093Z","updated_at":"2026-05-14T21:34:00.335Z","avatar_url":"https://github.com/end2endzone.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# win32Arduino #\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n[![Github Releases](https://img.shields.io/github/release/end2endzone/win32Arduino.svg)](https://github.com/end2endzone/win32Arduino/releases)\n\nwin32Arduino is a Windows/Linux implementation of arduino functions. It allows a developer to unit test an arduino library outside of the arduino platform.\n\nThe library allows to easily unit test an arduino library using your testing framework of choice. For instance, the unit tests of win32Arduino library are executed using the [Google Test framework](http://github.com/google/googletest).\n\n\n\n## Status ##\n\nBuild:\n\n| Service | Build | Tests |\n|----|-------|-------|\n| AppVeyor | [![Build status](https://img.shields.io/appveyor/ci/end2endzone/win32Arduino/master.svg?logo=appveyor)](https://ci.appveyor.com/project/end2endzone/win32arduino) | [![Tests status](https://img.shields.io/appveyor/tests/end2endzone/win32arduino/master.svg?logo=appveyor)](https://ci.appveyor.com/project/end2endzone/win32arduino/branch/master/tests) |\n| Travis CI | [![Build Status](https://img.shields.io/travis/end2endzone/win32Arduino/master.svg?logo=travis\u0026style=flat)](https://travis-ci.org/end2endzone/win32Arduino) |  |\n\nStatistics:\n\n| AppVeyor | Travic CI |\n|----------|-----------|\n| [![Statistics](https://buildstats.info/appveyor/chart/end2endzone/win32arduino)](https://ci.appveyor.com/project/end2endzone/win32arduino/branch/master) | [![Statistics](https://buildstats.info/travisci/chart/end2endzone/win32Arduino)](https://travis-ci.org/end2endzone/win32Arduino) |\n\n\n\n\n# Features #\n\nThe main features of the library are:\n\n* Implements many arduino functions.\n* Support all functions that reads or writes values to pins.\n* Advanced time handling mechanism. Supports realtime, incremental or custom `millis()` and `micros()` functions to simulate time.\n* Call history and logging support. Calls to the `Serial` class are also forwarded to the output log file.\n* Attach function callbacks to any native arduino function.\n* Attach function callbacks to `millis()` or `macros()` functions for time based event programming.\n* Supports interrupts functions: `attachInterrupt()`, `cli()`, `noInterrupts()`, `interrupts()` and `SREG` registry.\n\n\nLimitations:\n* Pins specific functionality is disabled. In other words, all pins are identical and shall considered supporting analog and digital values.\n* AVR, POWER, SERIAL, SPI, I2C is not supported.\n* PWM is not supported. Simulating PWM changes over time on each PWM pins is hard.\n* Pin resolution functions (`analogReadResolution()` and `analogWriteResolution()`) is not implemented. Pins values is always stored using a resolution of 10 bits.\n* Shift functions (`shiftIn()` and `shiftOut()`) are not implemented.\n* The following functions are also empty shells: `tone()`, `noTone()` and `pulseIn()`.\n\n\n\n\n# Usage #\n\nThe following instructions show how to use the library.\n\n\n\n\n## Testing your own library ##\n\nArduino library source code must be added to a win32/linux project to be compiled and tested outside of the arduino environment.\n\nThe following instructions show how to test your own library with win32Arduino.\n\n\n\n### 1) Verify library prerequisites ###\n\nTo be compatible with the files provided by win32Arduino, an arduino library must implement the [Arduino IDE 1.5: Library specification](https://github.com/arduino/Arduino/wiki/Arduino-IDE-1.5:-Library-specification).\n\nSource files must be stored in `src/` directory.\n\nUnit tests are expected to be written using the [Google Test framework](https://github.com/google/googletest/). This guide assumes that you are already familiar with the googletest API.\n\nUnit test files must be stored in `test/` directory.\n\n\n\n### 2) Copy CMake template files to your library project ###\n\nThe win32Arduino expect your arduino library project to be compatible with the CMake build system. CMake build system is used to generate a platform-specific (Windows or Linux) build environment.\n\nwin32Arduino provides template files that must be copied from `/usage/template/` directory into the arduino library project.\n\nIn case of conflict (if the copied files already exist or if your library is already using CMake), you must merge the files manually.\n\n\n\n### 3) Build library unit tests ###\n\nTo generate the Windows or Linux project files, open a command prompt, browse to your arduino library directory and enter the following commands:\n\n```\nmkdir build\ncd build\ncmake ..\n```\n\nTo build the project, enter the following command (based on your platform):\n  1) On Windows, run `cmake --build . --config Release`.\n  2) On Linux, run `make` command.\n  \n\n  \n### Troubleshooting ###\n\nThe `CMakeLists.txt` file is expecting to find your test files in the `test/` directory and your library source files in the `src/` directory.\n\nNote that `CMakeLists.txt` file does not automatically search for dependencies. If the tested arduino library depends on another, you must manually edit the `CMakeLists.txt` file and add the required lines to resolve all dependencies and have a successful build.\n\n\n\n\n## Source code example ##\n\nThe following section shows an example of using win32Arduino.\n\nAssume a developer needs to test the following library function:\n```cpp\nbool waitForButtonPress(uint8_t buttonPin, uint32_t timeout) {\n  uint32_t start = millis();\n  while( millis() - start \u003c timeout )\n  {\n    //look for button state\n    int buttonValue = digitalRead(buttonPin);\n    if (buttonValue == LOW)\n      return true;\n  }\n  //timeout\n  return false;\n}\n```\n\nUsing Google Test framework, one can write the following unit test to validate the behavior of the `waitForButtonPress()` function:\n\n```cpp\nvoid simulatePinLowISR() {\n  testarduino::setPinDigitalValue(2, LOW);\n}\nTEST(TestButtonLibrary, testWaitForButtonPressTimeout) {\n  testarduino::reset();\n  IncrementalClockStrategy \u0026 clock = IncrementalClockStrategy::getInstance();\n  clock.setMicrosecondsCounter(0);\n  clock.setMicrosecondsResolution(100); //increase simulated clock by 0.1ms for every calls to micros()\n  static const uint8_t buttonPin = 2;\n  static const uint32_t MAX_WAIT_TIME = 5000; //ms\n  testarduino::setPinDigitalValue(buttonPin, HIGH); //simulate pin pull-up resistor\n\n  //assert that false is returned if button is not pressed\n  uint32_t time1 = millis();\n  bool result = waitForButtonPress(buttonPin, MAX_WAIT_TIME);\n  uint32_t time2 = millis();\n  uint32_t elapsed = time2 - time1;\n  ASSERT_FALSE(result);\n  ASSERT_EQ(MAX_WAIT_TIME, elapsed);\n\n  //configure win32Arduino library to push a button in 2000 ms.\n  static const uint32_t BUTTON_DELAY_TIME = 2000; //ms\n  uint32_t buttonPressTime = millis() + BUTTON_DELAY_TIME;\n  attachMillisecondsCallback(buttonPressTime, simulatePinLowISR); //in 2000 ms, the button pin will go LOW\n\n  //run the function again...\n  //assert that function is interrupted when a button is pressed\n  time1 = millis();\n  result = waitForButtonPress(buttonPin, MAX_WAIT_TIME);\n  time2 = millis();\n  elapsed = time2 - time1;\n  ASSERT_TRUE(result);\n  ASSERT_EQ(BUTTON_DELAY_TIME, elapsed);\n}\n```\n\n\n\n# Build / Install / Testing #\n\nPlease refer to file [INSTALL.md](INSTALL.md) for details on how installing/building the application.\n\n\n\n\n# Platforms #\n\nwin32Arduino has been tested with the following platform:\n\n  * Linux x86/x64\n  * Windows x86/x64\n\n\n  \n  \n# Versioning #\n\nWe use [Semantic Versioning 2.0.0](http://semver.org/) for versioning. For the versions available, see the [tags on this repository](https://github.com/end2endzone/win32Arduino/tags).\n\n\n\n\n# Authors #\n\n* **Antoine Beauchamp** - *Initial work* - [end2endzone](https://github.com/end2endzone)\n\nSee also the list of [contributors](https://github.com/end2endzone/win32Arduino/blob/master/AUTHORS) who participated in this project.\n\n\n\n\n# License #\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fend2endzone%2Fwin32arduino","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fend2endzone%2Fwin32arduino","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fend2endzone%2Fwin32arduino/lists"}