Teensy LC PWM Pins and timers

Status
Not open for further replies.

Headroom

Well-known member
The Teensy Pulse Width and Tone on Teensy with Arduino page contains a nice little table which PWM pins are tied to what timer.
However It misses the information for the Teensy LC:

Screen Shot 2015-09-08 at 7.10.13 PM.png


I am designing a little project that requires 8 different PWM pins. 6 of these will use one PWM frequency and resolution to control 2 high brightness RGB LED's. The remaining two PWM pins will control the overall brightness using another PWM frequency/resolution. As such I'd need to know what pins are tied to what timers.
 
Awesome! thanks for the quick fix. I am off now to redraw some connections on my schematic. Patience has never been my strength ;-)
 
Granted this is an old thread, but I'm considering learning with the Teensy 3.2, and I'm confused by the frequency / PWM table. I've looked at various threads and some articles, but wanted to be sure that I can get 12 bit resolution. The discussion on the PJRC page with the table is a bit confusing because it looks like I can set the PW resolution, but it always gets rounded down to 8 bits.

Could someone please clarify?

Thanks
 
Yes, you can get 12 bits of resolution. But only if the frequency is low enough. On Teensy LC, you can use up to 11718.75 Hz. If you set the PWM frequency higher, it will have less the the full 12 bits. Your writes will automatically be scaled to the actual res possible by whatever frequency is set.
 
Hi Paul,
Can I use PWM as audio output in LC?..As I am getting error for below code.

#include <Audio.h>
#include <Wire.h>
#include <SPI.h>
#include <SD.h>
#include <SerialFlash.h>
#include <Bounce.h>
#include"AudioSampleTone2005.h"



//AudioPlaySdWav playWav1;
AudioPlayMemory playmem;
AudioOutputPWM pwmpwm;
AudioOutputAnalog audioOutput;
//AudioMixer4 mixer1; //xy=392,206
//AudioFilterBiquad biquad1; //xy=257,60
AudioConnection patchCord1(playmem,pwmpwm);
///AudioConnection patchCord2(biquad1, audioOutput);
//AudioConnection patchCord1(playmem,audioOutput);


void setup() //initialise device & connect to access point in setup
{

Serial.begin(115200); // usb serial connects to to pc

AudioMemory(8);
// SPI.setMISO(12);
// SPI.setMOSI(11);
// SPI.setSCK(13);
// SD.begin(10);
//biquad1.setHighpass(0,17000,0.707);
// mixer1.gain(0,1);
//audioOutput.analogReference(EXTERNAL);
// audioOutput.analogReference(INTERNAL);
// fadeIn(10);
// fadeOut(10);
// audioOutput.analogReference(INTERNAL);
}



void playFile()//const char *filename)
{
// Serial.print("Playing file: ");
//Serial.println(filename);

// Start playing the file. This sketch continues to
// run while the file plays.
playmem.play(AudioSampleTone2005);

// A brief delay for the library read WAV info
delay(5);

// Simply wait for the file to finish playing.
while (playmem.isPlaying()) {
// uncomment these lines if you audio shield
// has the optional volume pot soldered
//float vol = analogRead(15);
//vol = vol / 1024;
// sgtl5000_1.volume(vol);
}
}



void loop()
{
//playFile("TEST.WAV");
playFile();
delay(1000);
}


In function `AudioOutputPWM':
/home/dev5/arduino-1.6.5/hardware/teensy/avr/libraries/Audio/output_pwm.h:36: undefined reference to `AudioOutputPWM::begin()'
collect2: error: ld returned 1 exit status
Error compiling.
 
Status
Not open for further replies.
Back
Top