SunFounder Basic Sensor Kit for Raspberry Pi

If you look in the source code, you can see that print is a statement, e.g. print 'relay off...', that means it's Python 2.7, since in Python 3 print is a function, would be: print ("relay off...").
 
As far as I can tell it's all Python, assuming the GPIO Python library is available it should work as-is.

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.

Just found it here:-

https://learn.adafruit.com/playing-...spberry-pi/install-python-module-rpi-dot-gpio

and here:-

https://sourceforge.net/projects/raspberry-gpio-python/

But this looks more promising:-

https://github.com/evadot/fbsd_gpio_py
 
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

Just wondered if anyone has tried this....
 
Further to my quest for a FreeBSD RPi.GPIO module, I asked on the RPi forum about how to build such a module and got this response:-
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.

I see that I do have a /dev/mem. Is it worth trying this?
 
A while ago I experimented with /dev/mem for similar purpose for BeagleBone Black. It works, but you have to read/write all registers manually, kind of writing your own driver.
 
Back
Top