Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 4 of 4

Thread: LED problem with Teensy 4.0 and TFT display

  1. #1

    LED problem with Teensy 4.0 and TFT display

    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?

    // 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)
      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)
        if (digitalRead(LED_BUILTIN) == HIGH)
          digitalWrite(LED_BUILTIN, LOW);
          digitalWrite(LED_BUILTIN, HIGH);
        prevT = t;

  2. #2
    Senior Member
    Join Date
    Nov 2012
    SPI uses pin13 as its SCK signal but pin 13 is also the LED. You can try moving SCK to pin 14:

  3. #3
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    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.

  4. #4
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts