Skip to content
Modern c++ Arduino libray
C++ Makefile
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
include
sample/blink
Makefile
README.md

README.md

MOCD -- A Modern C++ adaptor for Arduino.

This is a library to make Arduino development closer to the usual C++ way of thinking.

RAII

The main objective is to enable "pseudo-RAII" for many of the arduino libraries that drives different elements. Most of them expect you to follow the following pattern :

#include "my_hardware.hpp"

// Connected to pin 2
my_hardware_type my_device;

void setup()
{
    my_device.begin(2);
}

void loop()
{
    delay(1000);
    my_device.make_magic();
}

To something like this :

using my_device = mocd::device<magic_driver<2>>;

void setup() { /* Nothig expected here */ }

void loop()
{
    my_device::controller test;

    test->make_magic()
}

This may make the first run of the loop have slightly different timings than the normal run, but this is something I'm willing to live with.

You can’t perform that action at this time.