12th Anniversary Sale 12% Off in July & August with the voucher code "SUMMER12" *excludes trade customers
Support Forum

Share your projects and post your questions

Register   or   Sign In
The Forum

GPIO.setmode(GPIO.BOARD) Error

The Servo PWM Pi is a 16-channel, 12-bit PWM controller for driving LEDs and RC servos on the Raspberry Pi

19/05/2020

Posted by:
user387283

user387283 Avatar

When creating a new instance of the Servo class an error is being thrown. It happens on line 142 where GPIO.setmode(GPIO.BOARD) is being called.

ValueError: A different mode has already been set!

I am confused as to why this is happening since in my code I am not even using the RPi.GPIO class and therefore not setting the mode for the GPIO before this instance.

19/05/2020

Posted by:
andrew

andrew Avatar

Location:
United Kingdom

andrew Twitter  andrew Website  

Hello

The error you are getting normally occurs if the GPIO mode has already been set by another program on the Raspberry Pi. I am not sure why you are getting the error if you have not used the RPi.GPIO class elsewhere.

I have updated the Servo Pi library to make it check to see if the GPIO mode has already been set and if it has, use the selected GPIO mode. Hopefully, this will fix the error that you are getting.

You can download a new version of the Servo Pi library from our GitHub repository at Servo Pi GitHub Repository

Sign in to post your reply


Note: documents in Portable Document Format (PDF) require Adobe Acrobat Reader 5.0 or higher to view.
Download Adobe Acrobat Reader or other PDF reading software for your computer or mobile device.