All Projects → thijse → Arduino Cmdmessenger

thijse / Arduino Cmdmessenger

Licence: other
CmdMessenger Communication library for Arduino & .NET

Projects that are alternatives of or similar to Arduino Cmdmessenger

Androbd
Android OBD diagnostics with any ELM327 adapter
Stars: ✭ 573 (+227.43%)
Mutual labels:  usb, serial, bluetooth
Flingos
An educational operating system written in C#. A great stepping stone from high to low level development.
Stars: ✭ 451 (+157.71%)
Mutual labels:  usb, serial
Androidbluetoothlibrary
A Library for easy implementation of Serial Bluetooth Classic and Low Energy on Android. 💙
Stars: ✭ 171 (-2.29%)
Mutual labels:  serial, bluetooth
Node Escpos
🖨️ ESC/POS Printer driver for node
Stars: ✭ 752 (+329.71%)
Mutual labels:  usb, bluetooth
Authorizer
Authorizer is a Password Manager for Android. It emulates an HID keyboard over USB and enters your credentials on your target device. Additionally it supports OTP 🔑📴
Stars: ✭ 172 (-1.71%)
Mutual labels:  usb, bluetooth
Gimx
The GIMX software.
Stars: ✭ 421 (+140.57%)
Mutual labels:  usb, bluetooth
Hidapi
A Simple library for communicating with USB and Bluetooth HID devices on Linux, Mac and Windows.
Stars: ✭ 465 (+165.71%)
Mutual labels:  usb, bluetooth
DualSenseWindows UE4
Unreal Engine 4 port of the Windows API for the PS5 DualSense controller created at Ohjurot/DualSense-Windows
Stars: ✭ 25 (-85.71%)
Mutual labels:  usb, bluetooth
Jsprintmanager
Advanced Client-side Printing & Scanning Solution for Javascript
Stars: ✭ 74 (-57.71%)
Mutual labels:  usb, serial
Arduino Robust Serial
A simple and robust serial communication protocol. It was designed for Arduino but can be used for other purposes (e.g. bluetooth, sockets). Implementation in C Arduino, C++, Python and Rust.
Stars: ✭ 83 (-52.57%)
Mutual labels:  serial, bluetooth
Usbserial
Usb serial controller for Android
Stars: ✭ 1,301 (+643.43%)
Mutual labels:  usb, serial
BOSCH-GLM-rangefinder
Python script to remote control a BOSCH GLM 100C rangefinder via its Bluetooth serial interface
Stars: ✭ 41 (-76.57%)
Mutual labels:  serial, bluetooth
ESP32-3DPrinter-Bridge
A network <=> ESP32 <=> USB (FTDI) <=> 3D printer Bridge
Stars: ✭ 30 (-82.86%)
Mutual labels:  serial, usb
Node Bluetooth Serial Port
Serial I/O over bluetooth for NodeJS
Stars: ✭ 444 (+153.71%)
Mutual labels:  serial, bluetooth
android-bluetooth-serial
A library for Android to simplify basic serial communication over Bluetooth, for example when communicating with Arduinos.
Stars: ✭ 120 (-31.43%)
Mutual labels:  serial, bluetooth
Johnny Five
JavaScript Robotics and IoT programming framework, developed at Bocoup.
Stars: ✭ 12,498 (+7041.71%)
Mutual labels:  serial, bluetooth
Quad-Serial
Quad serial project with FTDI CI's, Isolation and 1.8~5.5v UART port.
Stars: ✭ 17 (-90.29%)
Mutual labels:  serial, usb
awesome-webhid
Curated list of resources relating to the WebHID (Human Interface Device) API
Stars: ✭ 126 (-28%)
Mutual labels:  usb, bluetooth
Apple Family
A simple framework that brings Apple devices together - like a family
Stars: ✭ 59 (-66.29%)
Mutual labels:  usb, bluetooth
Dualsense Windows
Windows API for the PS5 DualSense controller
Stars: ✭ 111 (-36.57%)
Mutual labels:  usb, bluetooth

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

  • both send and receive of commands
  • Both write and read multiple arguments
  • Both write and read all primary data types
  • Attach callback functions any received command

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
  • If you want to have a package that includes all referenced libraries, use the pre-packaged library
  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.

  • On the Arduino side, it demonstrates how to:
    • Define commands
    • Set up a serial connection
    • Receive a command with a parameter from the PC
  • On the PC side, it demonstrates how to:
    • Define commands
    • Set up a serial connection
    • Send a command with a parameter to the Arduino

SendandReceive

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

  • it demonstrates how to:
    • Handle received commands that do not have a function attache
    • Send a command with a parameter to the PC
  • On the PC side, it demonstrates how to:
    • Handle received commands that do not have a function attached
    • Receive a command with a parameter from the Arduino

SendandReceiveArguments

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

  • On the arduino side, it demonstrates how to:
    • Return multiple types status
    • Receive multiple parameters,
    • Send multiple parameters
    • Call a function periodically
  • On the PC side, it demonstrates how to:
    • Send multiple parameters, and wait for response
    • Receive multiple parameters
    • Add logging events on data that has been sent or received

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.

  • On the Arduino side, it demonstrates how to:
    • Send binary parameters
    • Receive binary parameters
  • On the PC side, it demonstrates how to:
    • Receive multiple binary parameters,
    • Send multiple binary parameters
    • How callback events can be handled while the main program waits
    • How to calculate milliseconds, similar to Arduino function Millis()

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 :

  • Use CmdMessenger in combination with GUI applications
  • Use CmdMessenger in combination with ZedGraph
  • Use the StaleGeneralStrategy

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 :

  • use CmdMessenger in combination with GUI applications
  • use CmdMessenger in combination with ZedGraph
  • Send queued commandssds
  • use the CollapseCommandStrategy

SimpleWatchdog

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

  • Use auto scanning and connecting
  • Use watchdog

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

  • Use bluetooth connection
  • Use auto scanning and connecting
  • Use watchdog

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

  • Send queued commands
  • Add queue strategies

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:

  • there is no PC counterpart
  • it will only receive commands, instead of sending
  • commands it will use Serial.Print

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

  • If the PC and Arduino are not able to connect, chances are that either the selected port on the PC side is not correct or that the Arduino and PC are not at the same baud rate. Try it out by typing commands into the Arduino Serial Monitor, using the ConsoleShell
  • Some boards (e.g. Sparkfun Pro Micro) need DtrEnable set to be true.
  • If the port and baud rate are correct but callbacks are not being invoked, try looking at logging of sent and received data. See the SendandReceiveArguments project for an example.
  • If you have a problem that is hard to pinpoint, use the CommandMessengerTests testsuite. This project runs unit tests on several parts on the mayor parts of the CmdMessenger library. Note that the primary function is not to serve as an example, so the code may be less documented and clean as the example projects.

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

  • [Arduino] Additional autoConnect sample
  • [.Net/.Mono] Full Threading redesign.
  • [.Net/.Mono] AutoConnect & watchdog functionality.
  • [.Net/.Mono] Tested Linux compatibility
  • [.Net/.Mono] Visual Basic samples.
  • [.Net/.Mono] Native Bluetooth support (windows only)

CmdMessenger v3.6

  • [Arduino] Bugfix: approx 1 in 1000 commands failed, when multiple binary parameters are sent over
  • [Arduino] Bugfix: Binary sending of non-number would give compile time error
  • [Arduino] feature: Posibility to send command without argument
  • [Arduino] feature: Posibility to send floats with scientific notation, to get full float range
  • [.Net/.Mono] Added Unit tests
  • [.Net/.Mono] Consistent variables on .NET and Arduino side.
  • [.Net/.Mono] Major performance improvement (for boards like Teensy 3), by combining queued commands

CmdMessenger v3.5

  • [Arduino] Added console shell sample
  • [Arduino] Minor performance improvement
  • [.Net/.Mono] Minor performance improvement

CmdMessenger v3.4

  • [Arduino] Bug-fix in receiving binary values
  • [.Net/.Mono] Bug-fix that makes communication 100x (!) faster, while lowering system load
  • [.Net/.Mono] Added function to run on single core

CmdMessenger v3.3

  • [Arduino] Speed improvements for Teensy

CmdMessenger v3.2

  • [All] Clean transport layer interface makes it easy to implement other transport modes (Bluetooth, ZigBee, Web), even if they do not implement a virtual serial port
  • [.Net/.Mono] Adaptive throttling to work with transport layers of any speed
  • [.Net/.Mono] Smart queuing for smooth running applications and no hanging UI
  • [Arduino] Small fixes and sending long argument support

CmdMessenger v3.1

  • Adds 2 GUI examples

CmdMessenger v3.0

  • Wait for acknowlegde commands
  • Sending of common type arguments (float, int, char)
  • Multi-argument commands
  • Escaping of special characters in strings
  • Sending of binary data of any type (uses escaping, no need for Base-64 Encoding)
  • Bugfixes
  • Added code documentation
  • Added multiple samples

CmdMessenger v2

  • Updated to work with Arduino IDE 022
  • Enable / disable newline (print and ignore)
  • New generic example (works with all Arduinos)
  • More reliable process() loop.
  • User can set their own cmd and field seperator (defaults to ';' and ',')
  • Base-64 encoded data to avoid collisions with ^^
  • Works with Arduino Serial Monitor for easy debugging

Credit

  • Initial Messenger Library - Thomas Ouellet Fredericks.
  • CmdMessenger Version 1 - Neil Dudman.
  • CmdMessenger Version 2 - Dreamcat4.
  • CmdMessenger Version 3 - Thijs Elenbaas
  • CmdMessenger Version 4 - Thijs Elenbaas & Valeriy kucherenko

On using and modifying libraries

Copyright

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

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].