Hi. I've just purchased two of the adafruit i2c PWM servo shields so I can experiment with some servo ideas. Up until now i have been using node.js to control all of my arduino projects, and I'd like to keep going this way as I find the arduino code not as nice to use (and I've already invested a lot of time in node.js). The problem is there does not appear to be a library for running these shields on node. The closest thing I can find is https://www.npmjs.org/package/adafruit-i2c-pwm-driver which is for rasberrypi and beaglebone, so I don't think it's going to help me on arduino.
Any suggestions as to how to approach this? Has anyone else tried? Am I missing some really simple solution somewhere?
using node.js to run arduino PWM i2c servo shield
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- bitfidget
- Posts: 1
- Joined: Tue Oct 07, 2014 8:09 pm
- Franklin97355
- Posts: 23910
- Joined: Mon Apr 21, 2008 2:33 pm
Re: using node.js to run arduino PWM i2c servo shield
My best advice is to look at the Arduino code in the library and compare it to node.js code you have for other i2c devices. The commands in the library are:
Code: Select all
Search "::" (8 hits in 1 file)
Adafruit_PWMServoDriver.cpp (8 hits)
Line 31: Adafruit_PWMServoDriver::Adafruit_PWMServoDriver(uint8_t addr) {
Line 35: void Adafruit_PWMServoDriver::begin(void) {
Line 41: void Adafruit_PWMServoDriver::reset(void) {
Line 45: void Adafruit_PWMServoDriver::setPWMFreq(float freq) {
Line 72: void Adafruit_PWMServoDriver::setPWM(uint8_t num, uint16_t on, uint16_t off) {
Line 87: void Adafruit_PWMServoDriver::setPin(uint8_t num, uint16_t val, bool invert)
Line 119: uint8_t Adafruit_PWMServoDriver::read8(uint8_t addr) {
Line 128: void Adafruit_PWMServoDriver::write8(uint8_t addr, uint8_t d) {
Please be positive and constructive with your questions and comments.