PocketBeagle2 Examples

Hello everyone. Just wanted to post here regarding the PocketBeagle 2 examples if anyone wants to try them out.

They are simple examples showing how to do simple things like using GPIOs, PWM, IIO sensors, etc, in Python and Rust.

Anyone wanting to check out example devicetree overlays for PocketBeagle 2 can also checkout the techlab cape overlay.

I am thinking of moving the example’s repository to GitHub as well (like bb-imager, so I guess feel free to reply if there are any reasons not to.

1 Like

I’m trying to run these examples and running into problems.

debian@BeagleBone:~/vsx-examples/PocketBeagle-2/tonal_buzzer/python$ export PYTHONPATH=$HOME/vsx-examples/Libraries/python/beagle_helper/src:$PYTHONPATH
debian@BeagleBone:~/vsx-examples/PocketBeagle-2/tonal_buzzer/python$ sudo python main.py
Traceback (most recent call last):
  File "/home/debian/vsx-examples/PocketBeagle-2/tonal_buzzer/python/main.py", line 8, in <module>
    from beagle_helper import TonalBuzzer
ModuleNotFoundError: No module named 'beagle_helper'

I see, you are trying to run from terminal instead of vs code. In that case, you need to update PYTHONPATH as described here

Alternatively, you can also just source the .envrc that should be at the root of examples folder.

NOTE: The command in the readme is assuming that the examples folder is in home. So please change the path accordingly.

Ah I figured out what the issue was…

I didn’t have the user assigned to the gpio group. Which caused me to run python main.py with sudo thinking it was needed. When using sudo the env vars aren’t used, hence the “ModuleNotFoundError”

That’s weird. Did you create a new user? Because the default user is added to gpio group from what I remember.

I did…

I see. that makes sense then.