SunFounder PiDog Kit, Release 1.0
(continued from previous page)
direction = my_dog.ears.read()
print(f"sound direction: {direction}")
2.3.12 Pat the PiDog’s Head
The Touch Swich on the head of PiDog can detect how you touch it. You can call the following functions to use it.
Pidog.dual_touch.read()
• Touch the module from left to right (front to back for PiDog’s orientation), it will return "LS".
• Touch the module from right to left, it will return "RS".
• Touch the module If the left side of the module is touched, it will return "L".
• If the right side of the module is touched, it will return "R".
• If the module is not touched, it will return "N".
Here is an example of its use:
from pidog import Pidog
import time
my_dog = Pidog()
while True:
touch_status = my_dog.dual_touch.read()
print(f"touch_status: {touch_status}")
time.sleep(0.5)
2.3.13 More
The following address will explain the use of PiDog’s more basic functions:
• Vilib Library
Vilib is a library developed by SunFounder for Raspberry Pi camera.
It contains some practical functions, such as taking pictures, video recording, pose detection, face
detection, motion detection, image classification and so on.
• SunFounder Controller
SunFounder Controller is an application that allows users to customize the controller for controlling
their robot or as an IoT platform.
2.3. Easy Coding 87