LED problem with Teensy 4.0 and TFT display

Status
Not open for further replies.

PickyBiker

Well-known member
The following code blinks the led in the teensy 4.0 once per second but if the TFT.Begin() command is executed, the LED won't blink. The Teensy is still running because the Serial print keeps going, but no blink and no change of status in the LED pin.
What is going on?

Code:
// The display uses hardware SPI, plus #9 & #10
#define TFT_RST -1  // dont use a reset pin, tie to arduino RST if you like
#define TFT_DC 9
#define TFT_CS 10

unsigned long t, prevT;
Adafruit_HX8357 tft = Adafruit_HX8357(TFT_CS, TFT_DC, TFT_RST);

/***************************************************************************************************************/
void setup(void)
{
  Serial.begin(115200);
  delay(250);
  pinMode(LED_BUILTIN, OUTPUT);
//  tft.begin();
//  tft.setRotation(1);
//  tft.fillScreen(0xff00);
//  tft.setTextColor(0xffff);
//  tft.setTextSize(3);

}
void loop()
{
  t = millis();

  if (t - prevT >= 1000)
  {
    Serial.println(digitalRead(LED_BUILTIN));
    if (digitalRead(LED_BUILTIN) == HIGH)
      digitalWrite(LED_BUILTIN, LOW);
    else
      digitalWrite(LED_BUILTIN, HIGH);
    prevT = t;
  }
}
 
SPI uses pin13 as its SCK signal but pin 13 is also the LED. You can try moving SCK to pin 14:
Code:
  SPI.setSCK(14);

Pete
 
According to Teensy cards unlike T_3.x's :: Teensy 4.x doesn't have option for SPI.setSCK(14);

Using SPI on T_4.x can only use pin #13 for SCK - so the LED_BUILTIN on Pin #13 can't be used as normal.
 
defragster is correct. I tried the SPI.setSCK(14); and it didn't change anything. SCK was stil functioning on pin 13.

Guess I need a different strategy for this.
 
Status
Not open for further replies.
Back
Top