I want to produce 12 bit resolution from Pi hardware pwm pin for my project. Please help me to go in right way as I am new to both Python and Pi.
import time
import pigpio as pi
import RPi.GPIO as g
g.setmode(g.BOARD)
g.setwarnings(False)
pi.set_PWM_range(12,4000)
print(pi.get_PWM_range(12))
g.setup(12,g.OUT)
p=pi.PWM(12,4000)
p.start(0)
try:
while 1:
for i in range(0,100,5):
p.ChangeDutyCycle(i)
time.sleep(0.1)
print(i)
for i in range(100,0,-5):
p.ChangeDutyCycle(i)
time.sleep(0.1)
print(i)
except KeyboardInterrupt:
pass
p.stop()
g.cleanup()
By runing this getting multiple error, i.e:
AttributeError: module 'pigpio' has no attribute 'set_PWM_range'