Coder Social home page Coder Social logo

tmcadam / arduino-toolkit Goto Github PK

View Code? Open in Web Editor NEW
4.0 2.0 1.0 67 KB

A bunch of helpers for use in Arduino projects, including unit tests and mocks of Arduino.h

C++ 89.95% C 4.22% Shell 5.83%
mocking mocks arduino arduino-library platformio catch catch-tests c-plus-plus

arduino-toolkit's Introduction

Arduino Toolkit Build Status

A bunch of handy tools (and Arduino mocks) to use in Arduino projects.

Install dependencies

Run build to install dependencies

  • cd <arduino-toolkit folder>
  • bash build.sh
    • You might get errors when it tries to run the tests, but don't worry about them (unless you want to run the tests), it will have downloaded dependencies by that point.

Usage

In PlatformIO you need to do some extra configuration to the platform.ini file.

  • add build_flags = -I <path to toolkit src folder>

    • i.e. build_flags = -I \home\tools\arduino-toolkit\src
  • add src_filter = +< <path to src files> >

    • i.e.src_filter = +<\home\tools\arduino-toolkit\src\timer.cpp>
  • You should then be able to use #include <timer.h> in your Arduino sketch.

Tests

I used this project to get started Arduino test driven developemnt (TDD). I have done some work on mocking a subset of the Arduino objects and methods (based on https://github.com/IronSavior/dsm2_tx), which may be useful to others (see tests/mocks). These basically allow you to develop your code without an Arduino hardware present, using a regular C++ compliler and testing framework (Catch2 - https://github.com/catchorg/Catch2).

Once you get beyond trivial sketches(and over the hump of creating the major mocks) I think this is a far quicker and robust way to produce Arduino code. It separates hardware weirdness (bad components, wobbly wires on breadboards etc.) from code weirdness, which makes it a lot easier to remove all the weirdness from your system.

To run the tests on Ubuntu, make sure you have g++-5 installed, then run the build script.

  • cd <arduino-toolkit folder>
  • bash build.sh

There are other scripts to run all tests and individual test suites if needed, see the tests folder.

ToDo

  • I am sure there are better ways to organise this project so it can work smoothly with both Arduino IDE and PlatformIO.
  • More examples

arduino-toolkit's People

Contributors

tmcadam avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

microcrisps

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.