SunFounder PiCar-X Kit
PiCar-X should take appropriate action based on the keyboard characters read. The lower() function converts upper
case characters into lower case characters, so that the letter remains valid regardless of case.
while True:
key = readchar.readkey()
key = key.lower()
if key in('wsadikjl'):
if 'w' == key:
pass
elif 's' == key:
pass
elif 'a' == key:
pass
elif 'd' == key:
pass
elif 'i' == key:
pass
elif 'k' == key:
pass
elif 'l' == key:
pass
elif 'j' == key:
pass
elif key == readchar.key.CTRL_C:
print("\n Quit")
break
Note: Hello, welcome to the SunFounder Raspberry Pi & Arduino & ESP32 Enthusiasts Community on Facebook!
Dive deeper into Raspberry Pi, Arduino, and ESP32 with fellow enthusiasts.
Why Join?
• Expert Support: Solve post-sale issues and technical challenges with help from our community and team.
• Learn & Share: Exchange tips and tutorials to enhance your skills.
• Exclusive Previews: Get early access to new product announcements and sneak peeks.
• Special Discounts: Enjoy exclusive discounts on our newest products.
• Festive Promotions and Giveaways: Take part in giveaways and holiday promotions.
Ready to explore and create with us? Click [] and join today!
4.5 3. Text to Speech & Sound Effect
In this example, we use PiCar-X’s (to be precise, Robot HAT’s) sound effects. It consists of three parts, namely Muisc,
Sound, Text to Speech.
4.5. 3. Text to Speech & Sound Effect 53