Git Product home page Git Product logo

Comments (7)

jcane86 avatar jcane86 commented on June 15, 2024

Hi @nrbrt looks like you got a new raspberry that my other lib didn't cover yet. If you uninstall motor-hat and reinstall it again, it should hopefully work now.

Sorry for the hassle, and thanks for reporting!

from motor-hat.

nrbrt avatar nrbrt commented on June 15, 2024

Not a problem! The support is awesome ;-)

from motor-hat.

nrbrt avatar nrbrt commented on June 15, 2024

ok, that works now. Thanks a lot! However, I have run into the next hurdle:

/home/pi/node-projects/motor/node_modules/i2c-bus/i2c-bus.js:423
    i2c.writeByteSync(peripheralSync(this, addr), cmd, byte);
        ^

Error: , Remote I/O error
    at Bus.writeByteSync (/home/pi/node-projects/motor/node_modules/i2c-bus/i2c-bus.js:423:9)
    at setAllPWMSync (/home/pi/node-projects/motor/node_modules/motor-hat/dist/pwm.js:203:9)
    at Object.init (/home/pi/node-projects/motor/node_modules/motor-hat/dist/pwm.js:244:7)
    at Object.init (/home/pi/node-projects/motor/node_modules/motor-hat/dist/index.js:219:11)
    at Object.<anonymous> (/home/pi/node-projects/motor/index.js:1:75)
    at Module._compile (internal/modules/cjs/loader.js:1158:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1178:10)
    at Module.load (internal/modules/cjs/loader.js:1002:32)
    at Function.Module._load (internal/modules/cjs/loader.js:901:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:74:12) {
  errno: 121,
  code: '',
  syscall: 'writeByteSync'
}

That happens when I try to run your example code:

var motorHat = require('motor-hat')({steppers: [{ W1: 'M1', W2: 'M2' }]}).init();
motorHat.steppers[0].setSpeed({pps:100});
motorHat.steppers[0].step('back', 2048, (err, result) => {
  if (err) return console.log('Oh no, there was an error', err);
  console.log(`Did ${result.steps} steps ${result.dir} in ${result.duration/1000} seconds. I had to retry ${result.retried} steps because you set me up quicker than your poor board can handle.`); 
});

Any ideas?

from motor-hat.

jcane86 avatar jcane86 commented on June 15, 2024

hi @nrbt, yeah, that looks like a common issue with the i2c address being different from the default.

see here #18.

I suggest trying to set the i2c to 0x60,that seems to be a common one

from motor-hat.

jcane86 avatar jcane86 commented on June 15, 2024

@nrbrt basically add the following to the example:

var motorHat = require('motor-hat')({
+  address: 0x60,
  steppers: [
    ['M1', 'M2'],
    ['M3', 'M4']
  ]
});

from motor-hat.

jcane86 avatar jcane86 commented on June 15, 2024

BTW, PRs to improve the readme to make this clearer are welcome

from motor-hat.

nrbrt avatar nrbrt commented on June 15, 2024

Wow, I completely missed that one. I think the address selection should be taken out of the "advanced usage" section. My idea was to learn how to walk before doing any running, so I ignored the advanced usage section for the moment and missed that crucial part. I will have a look and see how I can help and contribute to your project. Thanks again!

from motor-hat.

Related Issues (20)

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.