Trinket M0 PWM speed

Adafruit's tiny microcontroller platform. Please tell us which board you are using.
For CircuitPython issues, ask in the Adafruit CircuitPython forum.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
aoh
 
Posts: 1
Joined: Wed Jul 10, 2013 9:24 am

Trinket M0 PWM speed

Post by aoh »

I'd like to drive an IR led at 38KHz from a Trinket M0.

Would it be possible to set a suitable PWM frequency and use the onboard PWM output with half duty cycle?

User avatar
BryonMiller
 
Posts: 222
Joined: Fri Mar 04, 2016 10:34 am

Re: Trinket M0 PWM speed

Post by BryonMiller »

I wanted to do a similar thing to make an "IR Remote" like library for a Feather M0. But the more I dug into it the more I got concerned I was going to screw up some basic functionality of my board. I instead of using a PWM output I sent the 38kHz by bit banging. M0 is plenty fast enough to accommodate this particularly since IR Remote will not do anything else with the processor while sending codes. Lady Ada took this same approach when she built her IR Remote fork (see https://github.com/adafruit/Arduino-IRremote). Subsequent to this, I moved code using this library from a Feather M0 to a Trinket M0 with same success.

If your trying to drive a 38kHz IR LED as part of sending IR codes you could probably use that AdaFruit library. If your trying to drive 38kHz to an IR LED for some other reason you could possibly look at the implementation and see how we did it.

If you find a way to drive 38kHz with a PWM output without screwing up other M0 functions please post how you did it back here.

Locked
Please be positive and constructive with your questions and comments.

Return to “Trinket ATTiny, Trinket M0”