<commit_before><commit_msg>add draft for serial protocol documentation<commit_after># Tact Serial Protocol

The Tact libraries make use of a dedicated serial communication protocol to make sensor and desktop application talk to each other.

## Syntax
Each command consists of one uppercase command key, followed by four integers for configuring the sensor, followed by a newline char. Tact responds with an integer, which is a sum of "namespace" + value.

Processing example:

    P 0 48 32 1 \n
    
for humans: 

    Read Peak for sensor 0, 
    starting at position 48 of spectrum,
    read 32 measurements
    with a step-size of 1.
    
Arduino response:

    4312
    
Peak values are transmitted in a "namespace" or rather range between 4000 and 5000. Therefore, `4312-4000 = 312` is the requested peak value.


## Commands and Responses

| Data                            | Command Key   | Response               |
| :------------------------------ | :------------ | :--------------------- |
| Lib Version (initial handshake) | V             | `1000 + VERSION`       |
| Spectrum                        | S             | successively:          |
|                                 |               | `2000 + DATA_COUNT`    |
|                                 |               | `2976 + DATA`          |
|                                 |               | `2975`                 |
| Peak                            | P             | `4000 + PEAK`          |
| Bias                            | B             | `5024 + BIAS`          |
{'fraction_non_alphanumeric': 0.1033810143042913, 'fraction_numerical': 0.03836150845253576, 'mean_word_length': 1.2467153284671533, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 12, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4777425', 'n_tokens_mistral': 408, 'n_tokens_neox': 345, 'n_words': 148}