Closed MasahiroHanawa closed 2 years ago
Hi @MasahiroHanawa. I updated raspi-board to include your board revision. If you run npm upgrade
that first message should go away now.
Regarding the duty cycle, 40
is not a valid duty cycle. The duty cycle needs to be a value between 0
and 1
. If you want a duy cycle of 40%, you should pass in 0.4
.
I'm also seeing this issue:
Unknown board revision c03112, assuming Raspberry Pi 3 Model B+ pinout. Unless you are running a compute module or very old RPi this should work fine. Please report this board revision in a GitHub issue at https://github.com/nebrius/raspi-board.
which should similarly be fixed if the latest version of raspi-board (7.4.0) was being used, but it looks like npm is using raspi-board@5.3.1
since raspi-pwm@latest
depends on raspi-peripheral@^2.0.1
which depends on raspi-board@^5.0.0
so the highest version of raspi-board
that can be chosen is 5.3.1
.
I'm guessing the best solution would just be to publish a new version of raspi-pwm
that depends on the latest version of raspi-peripheral
(3.0.4), since that version depends on raspi-board@^7.1.2
which would let npm install raspi-board@7.4.0
package.json
{
"name": "pressure-test",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"start": "npm run build && node lib/index.js",
"build": "tsc --build"
},
"author": "",
"license": "ISC",
"devDependencies": {
"typescript": "4.4.3"
},
"dependencies": {
"i2c-bus": "5.2.2",
"raspi": "6.0.1",
"raspi-pwm": "6.0.0"
}
}
package-lock.json
{
"name": "pressure-test",
"version": "1.0.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
"bindings": {
"version": "1.5.0",
"resolved": "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz",
"integrity": "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==",
"requires": {
"file-uri-to-path": "1.0.0"
}
},
"file-uri-to-path": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz",
"integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw=="
},
"i2c-bus": {
"version": "5.2.2",
"resolved": "https://registry.npmjs.org/i2c-bus/-/i2c-bus-5.2.2.tgz",
"integrity": "sha512-b2y/et08rqggEjqod6QxV0Ng+RlSkZXsdE+E1aZEQBahepZ9uFD9XfA77Y8O9SgyhwfGEn+CNxsw0gvXW1/m4g==",
"requires": {
"bindings": "^1.5.0",
"nan": "^2.14.2"
}
},
"j5-io-types": {
"version": "2.5.0",
"resolved": "https://registry.npmjs.org/j5-io-types/-/j5-io-types-2.5.0.tgz",
"integrity": "sha512-S44ds7NZfVUL3xsvboNEIXnrZ0TDUPixKtdcO4+L3bUctWzAtHSTvPmyU9G8urqfzXl6d22xBq7c+sjGUrD4+w=="
},
"nan": {
"version": "2.15.0",
"resolved": "https://registry.npmjs.org/nan/-/nan-2.15.0.tgz",
"integrity": "sha512-8ZtvEnA2c5aYCZYd1cvgdnU6cqwixRoYg70xPLWUws5ORTa/lnw+u4amixRS/Ac5U5mQVgp9pnlSUnbNWFaWZQ=="
},
"pigpio": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/pigpio/-/pigpio-1.3.0.tgz",
"integrity": "sha512-9W6VBF6tvmLyEaYdp+3lZ0dvnFsdtH4lK6p7s0O1MX4pu92zwO6o2YUJQabF/0bmtnME5g40yURp7jGVjdRhcw==",
"requires": {
"bindings": "^1.5.0",
"nan": "^2.14.0"
}
},
"raspi": {
"version": "6.0.1",
"resolved": "https://registry.npmjs.org/raspi/-/raspi-6.0.1.tgz",
"integrity": "sha512-vv7P8QgUCC0wjN9aBGi7SKy7LClZSsIMSQyEE+GUVzImbX44OTftj3Vjo+Kbl2d+acmjBNNkEk/jnzXDZMcI5g==",
"requires": {
"j5-io-types": "^2.4.0",
"raspi-board": "^7.0.0"
}
},
"raspi-board": {
"version": "7.4.0",
"resolved": "https://registry.npmjs.org/raspi-board/-/raspi-board-7.4.0.tgz",
"integrity": "sha512-AMmBcXRm9UndFSu1bOaxQJrtx49UlXlvyQNPZzcWTrVznsX7Ttjtx97WmBfvtLygf0bPcJPIoxvrGVkAKLfxfA==",
"requires": {
"j5-io-types": "^2.4.0"
}
},
"raspi-peripheral": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/raspi-peripheral/-/raspi-peripheral-2.0.1.tgz",
"integrity": "sha512-SzCix2YJAVdRhK20aQIzaW/ERUr+Ybrr//iVCk0jcdA3/DjSL54ScM+qf3mOf1QVjWcukvxC1uvjMY94WCSpzg==",
"requires": {
"raspi-board": "^5.0.0"
},
"dependencies": {
"raspi-board": {
"version": "5.3.1",
"resolved": "https://registry.npmjs.org/raspi-board/-/raspi-board-5.3.1.tgz",
"integrity": "sha512-33vhNpo6UdofJJOMFN9050gwy6bWC4T+Aiy5Ud7bPzAFYuSpOYiDnXpi1Rotlhtl+BlQvhN1xixmhdEJssbiCA=="
}
}
},
"raspi-pwm": {
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/raspi-pwm/-/raspi-pwm-6.0.0.tgz",
"integrity": "sha512-d8fN7ZhREAPQSjgytia1DMgFWz+OeariLaESl6aE6lBM1F9LSQY9OU1ffvYBoggmTJ94kySQJt+BUT2c2efI0g==",
"requires": {
"pigpio": "^1.0.0",
"raspi-peripheral": "^2.0.1"
}
},
"typescript": {
"version": "4.4.3",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.4.3.tgz",
"integrity": "sha512-4xfscpisVgqqDfPaJo5vkd+Qd/ItkoagnHpufr+i2QCHBsNYp+G7UAoyFl8aPtx879u38wPV65rZ8qbGZijalA==",
"dev": true
}
}
}
FYI this module has been deprecated in favor of https://github.com/nebrius/raspi-soft-pwm/. Seeing as I forgot to actually run npm deprecate
on it before today though, I went ahead and bumped the dependency to get rid of this error.
When I try to use this module on Raspberry pi 4 Model Bm I got this error. Can you tell me how to fix it?
` Unknown board revision b03112, assuming Raspberry Pi Zero/2/3 pinout. Unless you are running a compute module or very old RPi this should work fine. Please report this board revision in a GitHub issue at https://github.com/nebrius/raspi-board. Unknown board revision b03112, assuming Raspberry Pi 3 Model B+ pinout. Unless you are running a compute module or very old RPi this should work fine. Please report this board revision in a GitHub issue at https://github.com/nebrius/raspi-board. /home/pi/Documents/Development/move_motor_test/node_modules/raspi-pwm/dist/index.js:128 throw new Error("Invalid PWM duty cycle " + dutyCycle); ^
Error: Invalid PWM duty cycle 40 at PWM.write (/home/pi/Documents/Development/move_motor_test/node_modules/raspi-pwm/dist/index.js:128:19) at /home/pi/Documents/Development/move_motor_test/index.js:7:6 at processTicksAndRejections (internal/process/task_queues.js:79:11) `