OSError:Failed to wirte byte
I didn’t purchase a pantilthat due to distance(China), so I’m planning to build a simple pan-tilt system myself. One question I have is how should I connect my two SG90 servos to the 40 pins of the Raspberry Pi? And what is the reason for the above problem? I hope someone can help me with this, thanks!
Welcome to the forum!!
The Pan and Tilt HAT that Tim has used in guides uses a microcontroller onboard to send signals to other servo’s so you’ll have to use either the Pi pins.
Core has a guide on using servo’s with the Pi: Controlling Standard Servos with Raspberry Pi - Tutorial Australia
The cause of the errors is that it expects the microcontroller to connected to the I2C pins of the Pi, the Python code starts communication via I2C and when it isn’t able to write anything it will throw the error.
So if I don’t have Pan Tilt HAT I can’t use the pantilthat library ?
Yeah, you’ll have to use another library - I’d have a look at the guide above!
Thank you for solving my problem!