<commit_before>#PyCmdMessenger

Python class for communication with an arduino using the
[CmdMessenger](https://github.com/thijse/Arduino-CmdMessenger) serial
communication library. It allows sending and recieving of messages with
arguments, as well as a recieving via a listener on its own thread.

This project is not affiliated with the CmdMessenger project, though it
obviously builds off of their excellent work.

### Installation:
 * From github: 
    + `git clone https://github.com/harmsm/PyCmdMessenger.git` 
    + `cd PyCmdMessenger`
    + `sudo python3 setup.py install`
 * From pipi:
    + `sudo pip3 install PyCmdMessenger`

For python 2.7, replace `python3` with `python` and `pip3` with `pip`.

To test the library:
 * Clone the source from git
 * Compile the arduino sketch in the `test` directory
 * Transfer the compiled sketch to an arduino plugged into the computer
 * Run the `test/run_test.py` script.  This will pass a variety of data types
   between the local computer and the arduino.

### Compatibility
 * Compatibility: python 3.x, python 2.7
 * Should work on all platforms supported by pyserial.  
 * Tested on a Raspberry Pi (raspbian) and linux machine (Ununtu 15.10).  Have 
not tested on Windows or OSX.

### Dependencies
 * pyserial (on local machine): https://github.com/pyserial/pyserial
 * CmdMessenger (on Arduino): https://github.com/thijse/Arduino-CmdMessenger

##Example code
--------------

A typical CmdMessenger message has the following structure:

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

The PyCmdMessenger class constructs/parses these strings, as well as sending 
them over the serial connection via pyserial. 

To ensure stable communication with PyCmdMessenger:

 * PyCmdMessenger instances must be given a list of command names in the *same*<commit_msg>updating readme<commit_after>#PyCmdMessenger

Python class for communication with an arduino using the
[CmdMessenger](https://github.com/thijse/Arduino-CmdMessenger) serial
communication library. It allows sending and recieving of messages with
arguments, as well as a recieving via a listener on its own thread.

This project is not affiliated with the CmdMessenger project, though it
obviously builds off of their excellent work.

### Installation:
 * From github: 
    + `git clone https://github.com/harmsm/PyCmdMessenger.git` 
    + `cd PyCmdMessenger`
    + `sudo python3 setup.py install`
 * From pipi:
    + `sudo pip3 install PyCmdMessenger`

For python 2.7, replace `python3` with `python` and `pip3` with `pip`.

To test the library:
 * Clone the source from git
 * Compile the arduino sketch in the `test` directory
 * Transfer the compiled sketch to an arduino plugged into the computer
 * Run the `test/run_test.py` script.  This will pass a variety of data types
   between the local computer and the arduino.

### Compatibility
 * Compatibility: python 3.x, python 2.7
 * Should work on all platforms supported by pyserial.  
 * Tested on a Raspberry Pi (raspbian) and linux machine (Ununtu 15.10).  Have 
not tested on Windows or OSX.

### Dependencies
 * pyserial (on local machine): https://github.com/pyserial/pyserial
 * CmdMessenger (on Arduino): https://github.com/thijse/Arduino-CmdMessenger

pyserial should be installed automatically by pip or the installaion script. 
For CmdMessenger, please follow the directions on their
[site](https://github.com/thijse/Arduino-CmdMessenger).  Copies of the 
CmdMessenter 4.0 main .cpp and .h files are included in the PyCmdMessenger repo
in the [test/arduino](https://github.com/harmsm/PyCmdMessenger/tree/master/test/arduino) and
[examples/arduino](https://github.com/harmsm/PyCmdMessenger/tree/master/examples/arduino)
directories. 


##Example code
--------------

A typical CmdMessenger message has the following structure:

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

The PyCmdMessenger class constructs/parses these strings, as well as sending 
them over the serial connection via pyserial. 

To ensure stable communication with PyCmdMessenger:

 * PyCmdMessenger instances must be given a list of command names in the *same*
{'fraction_non_alphanumeric': 0.08627833292712649, 'fraction_numerical': 0.007311723129417499, 'mean_word_length': 4.155778894472362, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 11, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1904944', 'n_tokens_mistral': 1280, 'n_tokens_neox': 1186, 'n_words': 488}