I know the onion-gpio-sysfs library for Python utilizes calls to sysfs to control and monitor GPIO lines. I did a quick google for node red sysfs GPIO and came up with this: https://flows.nodered.org/node/node-red-contrib-opi-gpio
Might give it a shot, I haven't tried it but I'd say there's a decent shot at it working.
[...] Could you please send me 100% work your code?
I see that you solved the problem already - cool!
Bus just in case - my implementation is this one, which is part of a larger set of utilities handling other peripherals such as i2c, spi, pwm and a lot of other stuff, based on a common mainloop for timers and I/O polling.
@Modest-Polykarpovich You don't need docker, as Windows 10 Home doesn't support Hyper-V but you can use other virtualisation products. VirtualBox will run on Windows 10 Home into which you install Linux, I use Ubuntu 18.
This has worked for me, thanks Lazar! I'm having some weird SPI no_cs issue now that I'm trying to work through...anytime that command is included in the Python project, sleep gets an argument error. If I comment that line out then the project runs without error. I'll report back if I get it resolved.
I seem to have found a solution for this issue, or at least a work around that works for me: YMMV
I've merged in the OpenWRT repo (git merge -X theirs openwrt/lede-17.01) into my OnionIoT/source repo. That built flawlessly ! :). So we're running kernel 4.4.153 now. That's nice on its own (always recommended to keep up with LTS kernel versions!).
Anyway, the SPI problem persisted. Then I removed the original Onion patch file for the spi-mt7621 module (rm ramips/patches-4.4/9999-spi-mt7621.patch) and rebuilt the image. Now we're using the unpatched mainline SPI driver. Guess what: this seems to work flawlessly! :) I'm a happy man now.
I only did some quick smoke tests, so it could be other SPI stuff breaks because of the missing patch. On the other hand, there have been some commits to the spi-mt7621 module in June, so the mainline might just be the only thing we need.
@Rogier-Lodewijks no, u don't need patch spidev, only spi-mt7621.c source file and it's in kernel yea. After this u can add cs-gpios in device tree, and spi device in node. Spi device can be spidev if u developing spi driver and u need its API. Thank you)