Change PWM frequency on Industruino IND.I/O D21G

Hello,

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?

Thank you,

Enrico

Enrico Foltran
Enrico Foltran
0
| 0 0 0
Asked on 9/10/18, 3:15 PM
0
vote
2610 Views

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.  

Tom
Tom
5675
| 1 1 3
Answered on 9/11/18, 12:31 AM
0
vote

Your answer

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!

Ask a Question

Keep Informed

About This Forum

This community is for professionals and enthusiasts of our products and services.

Read Guidelines

Question tools

47 follower(s)

Stats

Asked: 9/10/18, 3:15 PM
Seen: 2610 times
Last updated: 9/11/18, 12:31 AM