Skip to content

A simple Arduino Emulator that can be used in Windows, Linux or OS/X (fork)

Notifications You must be signed in to change notification settings

openlab-vn-ua/Arduino-Emulator

 
 

Repository files navigation

An Arduino C++ Emulator Library

Linux build Unit tests

Using this Project as a library

If you have an Arduino Sketch that you want to run e.g in Linux, OS/X or Windows you can include this library with cmake. Here is an example cmake file for an Arduino Audio Sketch).

GPIO/SPI/I2C

We provide some alternative implementations:

  • Dummy Implementatin which does nothing
  • Communicates changes to/from a Microcontroller using UDP
  • Rasperry PI

Rasperry PI

You can run this emulator on an Rasperry PI

  • make sure that the -DUSE_RPI cmake option is set to ON
  • install libgpiod-dev (sudo apt install libgpiod-dev)
  • activate SPI and I2C with raspi-config

Jupyter

I initially really wanted to have an interactive Jupyter environemnt in which I could play around with Arduino commands and when I discovered that Arduino provides a good starting point with their ArduinoCore-API I decided to start this project.

You can also use xeus-cling as a runtime environment to simulate an Arduino Development board and I have added the missing implementation using C or the C++ std library.

Here is a quick demo:

Supported Defines

You can activate/deactivate some functionality with the help of the following defines:

  • USE_RPI: activates support for Rasperry PI
  • USE_REMOTE: activates support for GPIO/SPI/I2C using UDP or Stream
  • USE_HTTPS: provide https support using wolfSSL
  • SKIP_HARDWARE_SETUP: deactivate all GPIO/SPI/I2C implementations
  • SKIP_HARDWARE_WIFI: deactivate WiFi

Build instructions

Execute the following commends in the root of the Arduino-Emulator:

git clone --recurse-submodules https://github.com/pschatzmann/Arduino-Emulator
cd Arduino-Emulator
mkdir build
cd build
cmake -DUSE_RPI=OFF -DUSE_HTTPS=OFF -DCMAKE_BUILD_TYPE=Debug ..
make

Adjust the cmake parameters dependent on your requirements.

Documentation

Usage notes

Case-insensitive file systems (Windows, OSX, WSL)

To avoid conflicts between system string.h and Arduino’s string library String.h, just do not put (include)/api to include path. Put (include) and (include)/api/deprecated instead. This usual way to resolve this conflict in all Arduino cores.

About

A simple Arduino Emulator that can be used in Windows, Linux or OS/X (fork)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 94.7%
  • C 3.3%
  • CMake 1.7%
  • Shell 0.3%