New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

motor-l298n

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

motor-l298n

Module to control an l298n motor controller on a Pi

  • 0.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

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:

MethodDescription
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:

  • Wiring-Pi - Node.js binding to wiringPi

Design Notes

Keywords

FAQs

Package last updated on 30 Apr 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc