Home

Awesome

CmdMessenger

License

A messaging library for the Arduino and .NET/Mono platform

C# Build status: C# Build status

VB# Build status: VB Build status

Arduino Build status: Build Status

Introduction

CmdMessenger is a messaging library for the Arduino Platform (and .NET/Mono platform). It supports multiple transport layers: serial port over USB, Bluetooth, TCP/IP (under development)

The message format is:

Cmd Id, param 1, [...] , param N;

Although the field separator ',' and command separator ';' can be changed

The library can

The library supports any primary data types, and zero to many multiple arguments. Arguments can either be sent in plain text (to be human readable) or in binary form (to be efficient).

With version 3.x also comes a full implementation of the toolkit in C#, which runs both in Mono (http://monodevelop.com/Download) and Visual Studio (http://www.microsoft.com/visualstudio/eng#downloads) This allows for full 2-way communication between the arduino controller and the PC.

If you are looking for a Python client to communicate with, please have a look at PyCmdMessenger

Requirements

* Earlier versions of the Arduino IDE will probably work but have not been tested.

Downloading

This package can be downloaded in different manners

  1. Go to https://github.com/thijse/Arduino-CmdMessenger
  2. Click the DOWNLOAD ZIP button in the panel on the
  3. Rename the uncompressed folder Arduino-CmdMessenger-master to CmdMessenger.
  4. You may need to create the libraries subfolder if its your first library.
  5. Place the CmdMessenger library folder in your arduinosketchfolder/libraries/ folder.
  6. Restart the IDE.
  7. For more information, read this extended manual
  1. Download the package as a zipfile here or as a tarball here .
  2. Copy the folders inside the libraries folder to you your arduinosketchfolder/libraries/ folder.
  3. Restart the IDE.
  4. For more information, read this extended manual

Getting Started

Get to know the library, by trying the examples,from simple to complex:

Receive

The 1st example will make the PC toggle the integrated led on the Arduino board.

SendandReceive

This example expands the previous Receive example. The Arduino will now send back a status. On the Arduino side,

SendandReceiveArguments

This example expands the previous SendandReceive example. The Arduino will now receive multiple and sent multiple float values.

SendandReceiveBinaryArguments

This example expands the previous SendandReceiveArguments example. The Arduino will receive and send multiple Binary values, demonstrating that this is more efficient way of communication.

DataLogging

This example expands the previous SendandReceiveArguments example. The PC will now send a start command to the Arduino, and wait for a response from the Arduino. The Arduino will start sending analog data which the PC will plot in a chart

This example shows how to :

ArduinoController

This example expands the SendandReceiveArguments example. The PC will now sends commands to the Arduino when the trackbar is pulled. Every TrackBarChanged events will queue a message to the Arduino to set the blink speed of the internal / pin 13 LED

This example shows how to :

SimpleWatchdog

This example shows the usage of the watchdog for communication over virtual serial port:

SimpleBluetooth

This example shows the usage of the watchdog for communication over Bluetooth, tested with the well known JY-MCU HC-05 and HC-06 On Arduino side, this uses the SimpleWatchdog.ino script as the previous example

TemperatureControl

This example expands the previous ArduinoController example. The PC will now send a start command to the Arduino, and wait for a response from the Arduino. The Arduino will start sending temperature data and the heater steering value data which the PC will plot in a chart. With a slider we can set the goal temperature, which will make the PID software on the controller adjust the setting of the heater.

This example shows how to design a responsive performance UI that sends and receives commands

ConsoleShell

This example shows how to use CmdMessenger as a shell, and communicate with it using the Serial Console This example is different from the others:

Below is an example of interacting with the sample:

   Available commands
   0;                  - This command list
   1,<led state>;      - Set led. 0 = off, 1 = on
   2,<led brightness>; - Set led brighness. 0 - 1000
   3;                  - Show led state
  
 Command> 3;
  
  Led status: on
  Led brightness: 500
  
 Command> 2,1000;
  
   Led status: on
   Led brightness: 1000
  
 Command> 1,0;
  
   Led status: off
   Led brightness: 1000

All samples are heavily documented and should be self explanatory.

  1. Open the Example sketch in the Arduino IDE and compile and upload it to your board.
  2. Open de CmdMessenger.sln solution in Visual Studio or Mono Develop/Xamarin Studio
  3. Set example project with same name as the Arduino sketch as start-up project, and run
  4. Enjoy!

Trouble shooting

Notes

An example for use with Max5 / MaxMSP was included up until version 2. (it can still be found here https://github.com/dreamcat4/CmdMessenger). Since we have not been able to check it wil Max/MaxMSP, the example was removed.

Changelog

CmdMessenger v4.0.0

CmdMessenger v3.6

CmdMessenger v3.5

CmdMessenger v3.4

CmdMessenger v3.3

CmdMessenger v3.2

CmdMessenger v3.1

CmdMessenger v3.0

CmdMessenger v2

Credit

On using and modifying libraries

Copyright

CmdMessenger is provided Copyright © 2013,2014,2015,2016, 2017 under MIT License.