I recently started programming the gopigo to be controlled with my keyboard and it worked great however there were some slight issues. I was using a video to help me regarding the servo kit from sentdex. Now I know he has the outdated version of the module so I just adapted his code into the newer one. However I cant seem to figure out this line of code to control the servo kit using the number keys on my keyboard. This is the code:
servo_range = [2,3,4,5,6,7,8] def key_input(event): key_press = event.keysym.lower() print(key_press) if key_press == 'w': gpg.forward() elif key_press == 's': gpg.backward() elif key_press == 'a': gpg.left() elif key_press == 'd': gpg.right() elif key_press == 'q': gpg.left_rot() elif key_press == 'e': gpg.right_rot() elif key_press == 'space': gpg.stop() elif key_press.isdigit(): if int(key_press) in servo_range: enable_servo() servo(int(key_press)*14) disable_servo()
so Regarding the servo kit, I get an error stating that global name ‘enable_servo’ is not defined. Also, Regarding the gpg.right_rot() and gpg.left_rot() the error is EasyGoPiGo3’ object has no attribute ‘left_rot’.
Does anybody know the correct attributes for these?