Closed bltzr closed 9 years ago
I checked the schematic and there's a strange swapping between the shift register and the darlington arrays. So, can you replace this part: https://github.com/nodesign/weio/blob/master/things/output/power/powerModule.py#L66-L67 by
if pin <= 7:
mask = value << (7-pin)
self.output = (self.output ^ mask)
else
mask = value << (15-pin)
self.output = (self.output ^ mask) << 8
and check if the pin are in the correct order ?
I attach the complete file on gist if it's easier for you : https://gist.github.com/ks156/29a20170c7189738090a
Thanks in advance,
Paul
I'm running the powerModule example. I have just added a print(a) after pwr.digitalWrite
I've plugged an LED strip to output 0 with this change: my LED just turns on on 0 and 8 (and turns off on 1 and 9) for output 1, it's on for 8 and 14 for output 2, that's 8 and 13 and so on...
when plugging on outputs >= 8 the physical output is lit between a=(15-ouput) and a=7 e.g. for a=14 the LED is on between 1 and 7 for a=9, LED is on between 6 and 7
Here's a new version with a correct remapping : https://gist.github.com/ks156/29a20170c7189738090a
Yes... Almost correct ;-)
Actually it had to be reversed: self.mapping = [8, 9, 10, 11, 12, 13, 14, 15, 0, 1, 2, 3, 4, 5, 6, 7] And then it works just fine !!!! Thanks for your help !
Thank you @bltzr. I've created a pull request. I'll see if @ukicar can confirm.
Thank you guys for this help and research. The error was caused by the difference in wiring from my original prototype and the one that came from 8devices. I fixed also portwrite function in this commit https://github.com/nodesign/weio/commit/7628fe6e688f891f70cb005de20f0039eaab9c23 now powerModule works as expected.
thank you again!
Nice, thank you @ukicar. Can you confirm that the schematics here https://github.com/nodesign/weioPowerModule is up-to-date with the actual prod version ? My first mapping (https://gist.github.com/ks156/29a20170c7189738090a#file-powermodule-py-L67) has been written from the schematic, but is actually wrong.
in https://github.com/nodesign/weio/blob/master/examples/actuators/powerModule/main.py#L22 with just a print(a) added before line 25
here's what I get when cycling through the ouptuts: there's an offset between the software output and the physical one
here's the mapping: SW output (a): physical output 0: 7 1: 6 2: 5 3: 4 4: 3 5: 2 6: 1 7: 0 8: 15 9: 14 and so on...