for an industrial application I'm working on, I'm wondering if there is an easy way to change the PWM frequency of a digital pin of an Industruino IND.I/O D21G to an arbitrary value, like for example 100Hz.
I have done this before with an Arduino Uno (Rev 3) using this library https://code.google.com/archive/p/arduino-pwm-frequency-library/ but I'm not sure if it is compatible with an Industruino IND.I/O D21G.
Have you ever done something like this?
Hi, please note that the usual analogWrite() instruction for PWM does not apply to the INDIO's digital channels. These channels are controlled via an I2C expander, with limited speed and no PWM functionality.
You can use timers and interrupts to create block waves on the digital output channels as described here: https://industruino.com/blog/our-news-1/post/d21g-timer-library-33 (bottom code for INDIO) - you could use this as a base to implement a PWM function with a few different duty cycles.
Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!