Giter Club home page Giter Club logo

node-motor-l298n's Introduction

motor-l298n

Control an l298n motor from the Raspberry Pi.

Install

The package can be installed using npm.

$ npm install motor-l298n

Usage

The class controls two motors connected to an L298N. The motors are known as LEFT and RIGHT.

We create an instance of an l298n with:

module.setup(in1Pin, in2Pin, enable1Pin, in3Pin, in4Pin, enable2Pin);

It has a number of core capabilities that are motor related. First we have the notion of the rotation speed. This is measured in a percentage of maximum speed:

l298n.setSpeed(side, 60);

Setting the speed doesn't actually cause the motor to turn. We would then call one of the direction functions which are:

l298n.forward(side);

and

l298n.backward(side);

Calling either of these starts the motor turning at the currently set speed. If we change the speed while the motor is rotating, it will change the rate of rotation.

If we wish to stop a motor from turning, we can call:

l298n.stop(side);

In summary, the methods are:

Method Description
setup(in1, in2, enable1, in3, in4, enable2) Setup the L298N
setSpeed(side, speed) Set the speed of rotation
forward(side) Start rotating forwards
backward(side) Start rotating backwards
stop(side) Stop rotating

Dependencies

This package depends upon:

Design Notes

node-motor-l298n's People

Contributors

nkolban avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.