Skip to content

charlesvdv/arduinint

Repository files navigation

Arduinint

Build Status

Interpret your arduino code into JSON. arduinint stands for ARDUIno INTerpreter.

Usage

Interpret code with arduinint is very straightforward. Firstly, you will need to write a configuration for the interpreter. See this part of the wiki. The simplest configuration is just giving the board like this:

{
    "board": "uno"
}

We can now interpret the code. Let's take an example for the tests folder. We will take the input read test. We launch the interpret by typing in the terminal:

./arduinint interpret --config tests/test_input_read/config.json tests/test_input_read/test.ino

arduinint returns, if no errors are found, a JSON with all the IO informations. The JSON looks like this:

{
  "io": [
    {
      "time": 0,
      "value": [
        {
          "pin": 0,
          "mode": 1,
          "value": 0,
          "forced": false
        },
        {
          "pin": 1,
          "mode": 0,
          "value": 0,
          "forced": false
        }
      ]
    },
    {
      "time": 5,
      "value": [
        {
          "pin": 0,
          "mode": 1,
          "value": 1,
          "forced": false
        },
        {
          "pin": 1,
          "mode": 0,
          "value": 1,
          "forced": false
        }
      ]
    }
  ]
}

We can see that at time 0, the pins 0 and 1 was in a LOW state. At the time 5, both pins are passed at the state HIGH.

Arduino support

The board and arduino library is currently being worked. Here is what is currently supported and what is expected to come.

Board

Functions

  • digitalRead, digitalWrite and pinMode
  • millis, micros
  • delai, delaiMicroseconds
  • attachInterrupt, detachInterrupt
  • analogRead, analogWrite
  • Serial functions
  • Math functions
  • Random numbers functions
  • Char functions

How is it working ?

As you may already know, arduino is a suite of tooling (function prototype generator, ...) and a library implementing low level micro-controller functions. The language itself is just C/C++.

arduinint is just a redefinition of this library and a naïve implementation of a micro-controller functions (see microclib). When the arduino code is running, arduinint will save data on IO states to image the pins state over time. Currently, the program is outputting a JSON showing the IO states history and possible errors due to faulty configuration.

The board input are configured before running the interpreter. See the wiki for more informations.

Dependencies

About

Interpret your arduino code into JSON.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published