Skip to main content

esp32 machine package for test-driving code off-chip

Project description

ESP32 Machine Emulator

The purpose of this package is to enable you to test-drive (TDD) your MicroPython code in an IDE running on your computer. It seems a lot of people are test-driving python, but not many are test-driving MicroPython. That’s understandable, since many MicroPython projects are simple, and emulating real hardware in a test environment is difficult.

The typical approach to emulating hardware is to replicate the hardware programming interface (the API). As of this writing, this library emulates a very small slice of the ESP32 API. I don’t know if the library will mature. Hopefully I’ll either flesh it out, someone else will take over, or a replacement will emerge.

If you are unfamiliar with the benefits of TDD or test-driving python, I encourage you to take some time to Google and learn. I prefer the pytest library over the unittest library that comes with python3, but you are free to test as you choose.

Getting Started

Take a look at the examples folder in the GitHub repository. Like I said, as of this writing, the library emulates a very small slice of the API, so if you don’t see an example for something you want to do, the feature is not available. Feel free to contact me or fork the repo and send me a pull request for the feature.

Here is the github repo for this project: https://github.com/tflander/esp32-machine-emulator

Supported Features

  • Emulating sending a GPIO digital out signal, and verifying the signal value.

  • Extending the time library to support sleep_ns() and sleep_ms()

  • Emulating the read pulse value of an input pin, such as that received by the echo pin of an HCSR04 Ultrasonic Distance Sensor.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

esp32_machine_emulator-0.0.5.tar.gz (3.2 kB view details)

Uploaded Source

File details

Details for the file esp32_machine_emulator-0.0.5.tar.gz.

File metadata

  • Download URL: esp32_machine_emulator-0.0.5.tar.gz
  • Upload date:
  • Size: 3.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.3

File hashes

Hashes for esp32_machine_emulator-0.0.5.tar.gz
Algorithm Hash digest
SHA256 80539c7f22883f3fd63dc2245ab6dad733e8fc12e5648c57fadbb4943335c582
MD5 f1a52f7d9f8949e67ebdb0b61796e1f8
BLAKE2b-256 b33aa71b5aadd253b21f1632086764df2cd5f34a87473a9d996bb8b4977a39be

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page