-
Notifications
You must be signed in to change notification settings - Fork 361
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Possible issue with multiple devices using the same driver #38
Comments
UpdateI wrote a (quite ugly) hack where I’m using the combined key Key in Robot.prototype.requireDriverthis.robot.drivers[driverName + opts.pin] |
Each device is supposed to create an associated driver object of that type. However, I see some errors in how this is currently implemented. We will look into it in bit, thanks for reporting it! |
Yes, it makes sense that each device has an instance of the driver. However, the driver probably shouldn’t need to be aware of the pin number, right? Thank you for building all these frameworks, they made for a fun hackday project :) |
I believe the code in the https://github.com/hybridgroup/cylon/tree/correct-driver-arch branch should correct your issue, if you want to give it a try, @peterhellberg |
Yes, I installed the code from the This code is now doing what it should:require('cylon').robot
connection:
name: 'arduino', adaptor: 'firmata', port: '/dev/cu.usbmodem1411'
devices:
[
{ name: 'red', pin: 11, driver: 'led' },
{ name: 'green', pin: 10, driver: 'led' }
]
work: (my) ->
every 1.second(), -> my.red.toggle()
every 2.second(), -> my.green.toggle()
.start() |
Configured devices
Log output
Problem
Only the first LED is initialized, if I reorder the lines, then the other LED is initialized instead.
The text was updated successfully, but these errors were encountered: