
Security News
GitHub Actions Checkout Now Blocks Risky pull_request_target Checkouts
GitHub Actions checkout now blocks risky pull_request_target checkouts by default to help prevent pwn request supply chain attacks.
pigpio-l298n
Advanced tools
基于pigpio实现的l298n的驱动.
可以使用 npm安装
$ npm install pigpio-l298n
可以控制两个连接到L298N的电机。电机被编号为NO1和NO2.
使用模块的例子
const readline = require('readline');
const L298N = require('../l298n.js');
//bcm code
let l298n = new L298N(17,27,22,null,null,null);
l298n.setSpeed(l298n.NO1,20);
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout
});
rl.on('line', function (input) {
if (input === 'quit()') {
rl.close();
} else if (input === 'f') {
l298n.forward(l298n.NO1);
} else if (input === 'b') {
l298n.backward(l298n.NO1)
} else if (input === 't') {
l298n.stop(l298n.NO1);
} else {
l298n.setSpeed(l298n.NO1,parseInt(input));
}
});
process.on("SIGINT", function(){
l298n.stop(l298n.NO1);
console.log('shutdown!');
process.exit(0);
});
设置转速
l298n.setSpeed(NUM(NO1\NO2), speed(0-100));
向前转动
l298n.forward(NUM(NO1\NO2));
向后转动
l298n.backward(NUM(NO1\NO2));
停止转动
l298n.stop(NUM(NO1\NO2));
FAQs
Module to control an l298n motor controller on a Pi,dependencies pigpio.
We found that pigpio-l298n demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

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.

Security News
GitHub Actions checkout now blocks risky pull_request_target checkouts by default to help prevent pwn request supply chain attacks.

Product
Socket now supports Custom Roles and Repository Access Permissions so organizations can control who can access specific repositories and actions.

Product
Socket MCP now lets AI assistants review org alerts, investigate threats using the Socket threat feed, and inspect package files in addition to dependency scoring.