PDA

View Full Version : PWM signal on teensy 2.0++ in C



ashitakalax
11-08-2012, 06:56 PM
Hi,

I'm in the process of trying to generate a PWM signal on the Teensy 2.0++. I would like to use C code, since the rest of my 2000+ lines of code are in C. I'm also using WINAVR to compile my code.

Does anyone know a "simple" way to generate a PWM on ardunio pins 27, 0, 1, physical pins B7, D0, C4, C5, C6?
I have seen the PJRC arduino analog write code/analog tutorial2(mid page) (http://www.pjrc.com/teensy/tutorial2.html) " arduino-x.x.x\hardware\arduino\cores\arduino\wiring_analog .c", this is ideal for generating a PWM signal for me. but this code was meant for non teensy boards.
Does anyone know where I can find the equivalent of this in teensy 2.0++?

or is there a way to import the arduino library into c code? (i know the libraries are in C, but i'm just a little lost as to how to add it to my code)

I've checked the "arduino-x.x.x\hardware\teensy\cores\teensy\" directory and i'm a little lost.

Thanks

ashitakalax
11-10-2012, 05:33 AM
I figured it out I'll post a larger solution upon my completion for the next users.