underbluewaters / sainsmart-16-hid

Control the Sainsmart 16-relay USB device from node.
MIT License
1 stars 0 forks source link

Not Talking to USB device #1

Open neileum opened 8 years ago

neileum commented 8 years ago

there seems to be an issue with this everything appears to load fine but it dose not seem to establish communication with the USB relay controller the red LED keeps flashing.

however if i run mvines cli test first to create the connection then run my code using your library it controls the relays fine.

underbluewaters commented 8 years ago

Thanks for the report. I am seeing this as well, and the mvines reset command does seem to get things running again. I haven't fixed this yet because in practice my production app doesn't get into this state ever. Seems to come up more during development.

I've started feature-improved-reset-command with a newer version of the reset command. Can you give it a try? If it works I'll merge it into master.

neileum commented 8 years ago

Thanks for replying so quick. copied the new index.js file in but no dice. when i power cycle the USB board and run my node app it still doesn't seem to connect.

i ran the cli test to get it back up but then when i went to run my node app it put the USB board back into the blinking state

DiskCrasher commented 7 years ago

Aren't you missing a character in the following method? Shouldn't it end with a 67 making it a full 14 bytes?

reset() { this.device.write([113, 14, 113, 0, 0, 0, 17, 17, 0, 0, 72, 73, 68]); }

underbluewaters commented 7 years ago

@DiskCrasher I gave it a try and it didn't help me. I still rely on running the mvines/relay test command to reset when I get into a problem state. Crappy solution but it works. I keep my relay board and pi on a UPS so I don't have to do it often.

DiskCrasher commented 7 years ago

@underbluewaters I didn't have any luck with this or other HID solutions (mainly for C#). So I looked at Java and found hid4java which I've managed to get to working. I can now turn on/off relays and read relay status (but haven't quite figured out how to parse that data yet).