A couple of years ago, I bought the SunFounder Basic Sensor Kit for Raspberry Pi which includes sample source code for various projects. It is obviously geared towards Linux, but should I expect to be able to compile some of the examples on FreeBSD?
As far as I can tell it's all Python, assuming the GPIO Python library is available it should work as-is.
ImportError: No module named RPi.GPIO
That could be the problem... I just tried the first program and get:-
Code:ImportError: No module named RPi.GPIO
Not knowing anything about Python, I don't whether this is simply unresolvable because the paths or environment isn't set up, or maybe I need to download/build it... Chances that it will only work on Raspian.
But this looks more promising:-
https://github.com/evadot/fbsd_gpio_py
If you have built Python 3.6 from source then it is as simple as :
Code: Select all
# pip3 install RPi.GPIO
Note that edge detection will probably not work as it depends on /sys/class/* provided by the Linux kernel.
I don't know FreeBSD at all. Does it provide /dev/mem? RPi.GPIO needs this too.