Skip to content

Modbus communication inspired by the Firmata command scheme

License

Notifications You must be signed in to change notification settings

shutch42/modmata

Repository files navigation

Modmata

This library is based on the modbus-arduino library, and is formatted to work in a way that is similar to the firmata arduino library.

The goal is to be able to write applications to communicate between a computer and arduino as you would with firmata, but using modbus communication instead of MIDI/Sysex messages.

This has the advantage of better error checking, faster communication, and more readable code.

The library is specificially designed for use on an Arduino Leonardo, or any Arduino IDE compatible microcontroller that uses an Atmega 32u4 chip. Specifically, this library was made to simplify the programming on the Lattepanda 3 Delta, but it can be used on any computer with an Arduino Leonardo plugged in via USB.

Functionality

By default, the library has functions to work with digital and analog I/O, servos, I2C, and SPI. These functions are listed in Functions.h.

If you wish to add a function that is not supported by default, you can do so using the attach() function. Take a look at the ModmataLCD program to see how to do this. Keep in mind that in order to use functions that are not supported by default in Modmata, you will need to write client-side functions as well. Take a look at the corresponding ModmataC LCD example program for an example of this.

Usage

To use the library, clone this repo to your Arduino IDE libraries folder. Once it is saved there, open up the Example program, StandardModmata.ino. This simple sketch is all that is needed to use Modmata on your Arduino Leonardo. Upload the sketch, and from there, you can program your arduino to do whatever you wish from our ModmataC library.

Documentation

Take a look at our Doxygen pages here.