I have an SX1509 IO Expander Board connected with a raspberry PI. I want to control a PWM connected to the IO Expander but have no idea how it works :shock:
Thanks for your reply. Here is a picture of how it is connected.
[
I am trying to run the mixer motor at different speeds while sending a PWM signal from the SX1509 Pin 8 to the PENGLIN PWM.
There is a PWM function on the raspberry where you define the frequency. I could not find the same for the SX1509 in the documentation.
I was wondering if I could generate the signal myself in a loop while turning it off and on. I just shared my idea here for the code but wasn’t sure if this is the right approach.
# Duty Cycle Is 20 kHz and should be 0.05 ms
# I want to give 50 % of the voltage to the motor so HighTIme = LowTime = 0.025
IOExpander.analogWrite(8, 1)
Time.Sleep(HighTime)
IOExpander.analogWrite(8, 0)
Time.sleep(LowTime)