<commit_before># diff-steer

> Provides a simple interface to a differential steering algorithm to control two motors from one two-axis joystick.

## Installation

    npm i diff-steer --save

## Usage

`diff-steer` accepts two inputs, a x-axis value and a y-axis value from a two-axis joystick. The first argument is the x-axis (from -1 to 1) and the second argument is the y-axis (-1 to 1):

```js
var diffSteer = require('diff-steer');
diffSteer(0, -1); // UP
// > [255, 255]
diffSteer(0, 1); // DOWN
// > [-255, -255]
diffSteer(-1, 0); // LEFT
// > [-255, 255]
diffSteer(1, 0); // RIGHT
// > [255, -255]
diffSteer(0.8, -0.74); // UPPER RIGHT
// > [255, -5.100000000000005]
```

The return value is an array of motor speeds for each motor ranging from 255 to -255. A positive number is "forward", and a negative number is "backward". You can then use those values however you need to.

It is configured out of the box to work with USB gamepads. For more information on interfacing with USB gamepads, checkout [`gamepad`][gamepad] or [`node-gamepad`][node-gamepad].

### Additional Configuration
<commit_msg>Add reference to original VB source code<commit_after># diff-steer

> Provides a simple interface to a differential steering algorithm to control two motors from one two-axis joystick.

Ported into Javascript from [http://www.codeproject.com/Tips/879300/Differential-Drive-Control-Algorithm](http://www.codeproject.com/Tips/879300/Differential-Drive-Control-Algorithm)

## Installation

    npm i diff-steer --save

## Usage

`diff-steer` accepts two inputs, a x-axis value and a y-axis value from a two-axis joystick. The first argument is the x-axis (from -1 to 1) and the second argument is the y-axis (-1 to 1):

```js
var diffSteer = require('diff-steer');
diffSteer(0, -1); // UP
// > [255, 255]
diffSteer(0, 1); // DOWN
// > [-255, -255]
diffSteer(-1, 0); // LEFT
// > [-255, 255]
diffSteer(1, 0); // RIGHT
// > [255, -255]
diffSteer(0.8, -0.74); // UPPER RIGHT
// > [255, -5.100000000000005]
```

The return value is an array of motor speeds for each motor ranging from 255 to -255. A positive number is "forward", and a negative number is "backward". You can then use those values however you need to.

It is configured out of the box to work with USB gamepads. For more information on interfacing with USB gamepads, checkout [`gamepad`][gamepad] or [`node-gamepad`][node-gamepad].

### Additional Configuration

{'fraction_non_alphanumeric': 0.1299876593994241, 'fraction_numerical': 0.059234882764294526, 'mean_word_length': 3.6859344894026975, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 2, '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': '3967456', 'n_tokens_mistral': 896, 'n_tokens_neox': 774, 'n_words': 319}