I have a custom teensy 3.1 with a strange problem.
the MK20 is on one board and the MINI54 from PJRC is on a little "programmer" board connected by a 2x6 header. programming. serial communication and everythiong works perfectly except for one thing.
pin 32 is connected to a resistor and LED it is simply supposed to turn it on and off at certain times.
what happens is that pin 32 goes high and the LED lights up when pin 9 is high instead. I have tested the actual circuit and the resistor for the LED is properly connected to pin 32(41) and there is no short between the 2 pins.
pin 9 is a PWM output for another LED the pin32 LED "follows" the brightness of the pin 9 LED (with the same frequency PWM) until it is full on, then after a few seconds it will flicker and go out.
if i set the pin 32 input in the setup, it lights up very dim. but can be made slightly less dim by setting the pin high while it is still an input!
all these LEDS are using quite high value resistors, they are bicolor red/green with 2.2k and 4.7k
my code is quite large and complicated, but the behavior can be duplicated (only on the custom teensy, not a PJRC one) with this:
also,
with this code pin 22 can also light the LED on pin 32 but only the first time around this loop.
the MK20 is on one board and the MINI54 from PJRC is on a little "programmer" board connected by a 2x6 header. programming. serial communication and everythiong works perfectly except for one thing.
pin 32 is connected to a resistor and LED it is simply supposed to turn it on and off at certain times.
what happens is that pin 32 goes high and the LED lights up when pin 9 is high instead. I have tested the actual circuit and the resistor for the LED is properly connected to pin 32(41) and there is no short between the 2 pins.
pin 9 is a PWM output for another LED the pin32 LED "follows" the brightness of the pin 9 LED (with the same frequency PWM) until it is full on, then after a few seconds it will flicker and go out.
if i set the pin 32 input in the setup, it lights up very dim. but can be made slightly less dim by setting the pin high while it is still an input!
all these LEDS are using quite high value resistors, they are bicolor red/green with 2.2k and 4.7k
my code is quite large and complicated, but the behavior can be duplicated (only on the custom teensy, not a PJRC one) with this:
Code:
void setup() {
// initialize the digital pin as an output.
for (int i = 0; i <= 31; i++){ pinMode(i, OUTPUT);}
pinMode(32, INPUT);
}
// the loop() methor runs over and over again,
// as long as the board has power
void loop() {
digitalWrite(22, HIGH); //only lights first time
delay(250);
digitalWrite(22, LOW);
delay(250);
digitalWrite(9, HIGH);
delay(250);
digitalWrite(9, LOW);
delay(250);
digitalWrite(22, HIGH);
digitalWrite(9, HIGH);
delay(250);
digitalWrite(32, HIGH);//dim
delay(250);
digitalWrite(32, LOW);//very dim
delay(250);
digitalWrite(22, LOW);
digitalWrite(9, LOW);
delay(250);
digitalWrite(32, HIGH);
delay(250);
digitalWrite(32, LOW);
delay(250);
}
also,
with this code pin 22 can also light the LED on pin 32 but only the first time around this loop.