I am using this example code PCA9685 in C and whenever I run the code I get this as my output:

PCA9685 servo example
Connect a servo to any pin. It will rotate to random angles
pwmWrite: You have not called one of the wiringPiSetup
functions, so I'm aborting your program before it crashes anyway.

I ran the example code using:


and still no luck. Does anyone have an idea?

2 Answers 2


I put this line of code and it works:

 wiringPiSetupGpio(); // Initalize Pi GPIO

Yes, before using any of the wiringPi functions, you have to initialize. One was already mentioned. There are other initialization functions, depending on what you want to do with wiringPi. wiringPi setup

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.