PiDog 2_function_demonstration.py not working

When I try and run the 2_function_demonstration.py it doesn’t work and I get the following in my terminal. Raspberry Pi4 latest Bookworm OS Thanks, Steve.

Blockquote

pidog@pidog:~ $ cd ~/pidog/examples
pidog@pidog:~/pidog/examples $ sudo python3 2_function_demonstration.py
config_file: /home/pidog/.config/pidog/pidog.conf
robot_hat init … done
imu_sh3001 init … done
rgb_strip init … done
dual_touch init … done
sound_direction init … done
sound_effect init … done
ultrasonic init … done
ERROR: Color number is greater than COLORS-1 (7).
Stopping and returning to the initial position …
Quit
Exception ignored in atexit callback: <function _shutdown at 0x7f75b78fe0>
Traceback (most recent call last):
File “/usr/lib/python3/dist-packages/gpiozero/devices.py”, line 627, in _shutdown
_devices_shutdown()
File “/usr/lib/python3/dist-packages/gpiozero/devices.py”, line 620, in _devices_shutdown
dev.close()
File “/usr/lib/python3/dist-packages/gpiozero/mixins.py”, line 79, in close
super().close()
File “/usr/lib/python3/dist-packages/gpiozero/devices.py”, line 568, in close
self._pin.close()
File “/usr/lib/python3/dist-packages/gpiozero/pins/lgpio.py”, line 133, in close
lgpio.gpio_claim_input(
File “/usr/lib/python3/dist-packages/lgpio.py”, line 755, in gpio_claim_input
return _u2i(_lgpio._gpio_claim_input(handle&0xffff, lFlags, gpio))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/lib/python3/dist-packages/lgpio.py”, line 458, in _u2i
raise error(error_text(v))
lgpio.error: ‘GPIO busy’
Exception ignored in: <function GPIOBase.del at 0x7f75b6f7e0>
Traceback (most recent call last):
File “/usr/lib/python3/dist-packages/gpiozero/devices.py”, line 148, in del
File “/usr/lib/python3/dist-packages/gpiozero/mixins.py”, line 79, in close
File “/usr/lib/python3/dist-packages/gpiozero/devices.py”, line 568, in close
File “/usr/lib/python3/dist-packages/gpiozero/pins/lgpio.py”, line 133, in close
File “/usr/lib/python3/dist-packages/lgpio.py”, line 755, in gpio_claim_input
File “/usr/lib/python3/dist-packages/lgpio.py”, line 458, in _u2i
lgpio.error: ‘GPIO busy’
pidog@pidog:~/pidog/examples $

Well, I started all over again, this time using the Raspberry Pi OS (Legacy) Bullseye as instructed (rather than the latest Bookworm).

Sound input card does not work. Tried both cables supplied. It cannot hear me.
ERROR: init_color() returned ERR on the camera.
Try and pick the thing up more than twice while running 6_be_picked_up.py the Pi will just freeze
The list just goes on and on.

I can’t be bothered listing and screen shotting all the errors this thing just keeps throwing at me when trying to use it.

More errors.

  1. about “init_color() returned ERR”, “ERROR: Color number is greater than COLORS-1 (7).” The error was caused by the Raspberry Pi recognizing the wrong color depth of the putty, we have fixed the problem, please update the code of pidog and re-run it:
    cd ~/pidog
    git pull
    sudo python3 setup.py install
    The latest version of pidog is 1.1.6. It should be noted that the color of the characters may vary when using a different Terminal to access the Raspberry Pi.

  2. basic_examples/10_imu_read.py program error has been fixed, please try to update it and re-run it

  3. regarding 6_be_picked_up.py we did not reproduce the problem, it is not clear if it is related to the sound card, please try to run the sound card installer to see if it works:
    cd ~/pidog
    sudo bash i2samp.sh

Thanks for that.

I worked out 6_be_picked_up.py It is too much power usage and even with a full battery it causes the Pi4 to reset.

1 Like