Forum Rule: Always post complete source code & details to reproduce any issue!
Page 4 of 4 FirstFirst ... 2 3 4
Results 76 to 87 of 87

Thread: Display_ili9341

  1. #76
    Junior Member
    Join Date
    Jul 2020
    Posts
    3
    Quote Originally Posted by KurtE View Post
    Sorry, I am not sure what you have or don't have? Maybe post a picture of your display? I believe I still have some of the first ones PJRC released, which would work fine with the different displays. However I am not sure how well the SDCards worked. I believe it was mostly suggested to not use them. But again I am not sure if much of this has changed since then.
    Here is the display I got from PJRC:
    Click image for larger version. 

Name:	IMG_20200722_081409.jpg 
Views:	88 
Size:	75.4 KB 
ID:	21078

  2. #77
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    9,567
    You should be able to make the same change to this display like HWGuy did in the thread: https://forum.pjrc.com/threads/28106...ll=1#post72889

    Where he removed the three resistors and replaced them with 0Ohm. Can probably maybe solder bridge it as well.
    Not sure if his other changes are necessary or not. Like the Solder jumper. My guess is that this bypasses the 5v to 3.3v VR on the board. So Vin can go directly to 3.3v instead of the higher voltage. But he then shows external Pull up resistors. Not sure if the external PU resistors he shows would be necessary or not on the SPI pins with this modification.

    Again I have not used the SD Card slots on these displays.

  3. #78
    Senior Member
    Join Date
    May 2017
    Posts
    123
    Quote Originally Posted by KurtE View Post
    You should be able to make the same change to this display like HWGuy did in the thread: https://forum.pjrc.com/threads/28106...ll=1#post72889

    Where he removed the three resistors and replaced them with 0Ohm. Can probably maybe solder bridge it as well.
    Not sure if his other changes are necessary or not. Like the Solder jumper. My guess is that this bypasses the 5v to 3.3v VR on the board. So Vin can go directly to 3.3v instead of the higher voltage. But he then shows external Pull up resistors. Not sure if the external PU resistors he shows would be necessary or not on the SPI pins with this modification.

    Again I have not used the SD Card slots on these displays.
    The pull ups are necessary. Otherwise you will get problems reading SD Card (wich I had).

  4. #79
    Senior Member
    Join Date
    Jan 2015
    Location
    France
    Posts
    158
    Hello,

    I'm looking for a convenient way to allow short press and long press on the display. Is there an easy way to do it ?

    Actually my code is this :

    Code:
    void loop() {
        if (ts.touched()) {                             // L'ecran a été touché, faire tourner les vues
          TS_Point p = ts.getPoint();
          if ((p.x >= 0) && (p.x <= 2500)) {
            ScreenChanged = false;
            if (num_screen != 0) {
              num_screen = num_screen - 1;
            }
            else {
              num_screen = 2;
            }
            changeScreen(num_screen);
            unsigned long currentMillis = millis();
            while (millis() < (currentMillis + debounceScreen));
          }
          else if ((p.x >= 2501) && (p.x <= 5000)) {
            ScreenChanged = false;
            num_screen = num_screen + 1;
            if (num_screen > 2) {
              num_screen = 0;
            }
            changeScreen(num_screen);
            unsigned long currentMillis = millis();
            while (millis() < (currentMillis + debounceScreen));
          }
        }
     }
    This code separate the screen in 2 areas, and in regard with the touched area the screen change from left to right, and vice-versa. My goal now is to allow detection of a long press on the screen (let's say 5secondes and more) to enter in a configuration mode.

    Thank you,
    Manu

  5. #80
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    15,086
    IIRC the one example set WasTouched in the if(ts.touched()) case. When setting that true the time could be recorded.

    Then in else case look for WasTouched being true and compare the time, and set WasTouched false. If the time between WasTouched and the release is >= 5 seconds then it would be the long press case.

  6. #81
    Senior Member
    Join Date
    Jan 2015
    Location
    France
    Posts
    158
    Quote Originally Posted by defragster View Post
    IIRC the one example set WasTouched in the if(ts.touched()) case. When setting that true the time could be recorded.

    Then in else case look for WasTouched being true and compare the time, and set WasTouched false. If the time between WasTouched and the release is >= 5 seconds then it would be the long press case.
    I'm sorry, but it's absolutely unclear :-(
    At least difficult to do (for me)

  7. #82
    Senior Member
    Join Date
    Jan 2015
    Location
    France
    Posts
    158
    I finally end with this code. It operate but I think it can be better :

    Code:
    #define debounceScreen 200    // Millisecondes
    #define longPress 3500
    
    bool wasTouched = false;
    bool wasReleased = false;
    bool config = false;
    unsigned long pressStart;
    
    void Screen_Config () {
      do something...
      config = false;
      return;
    }
    
    void loop() {
      if (Serial.available())                           // Mode configuration.
      {
        traiteCommandeFromSerialWithCRC();
      }
      if (TypeAfficheur == 0) {                         // L'afficheur est configuré en mode information
        if (ts.touched()) {                             // L'ecran a été touché, faire tourner les vues
          if (wasTouched == false) {
            pressStart = millis();
            wasReleased = false;
            wasTouched = true;
          }
        }
        else {
          if (wasTouched == true) {
            wasTouched = false;
            wasReleased = true;
          }
          if (((millis() - pressStart) >= longPress) && (wasReleased == true)) {
            pressStart = 0;
            wasReleased = false;
            config = true;
            Screen_Config();
          }
          else if (wasReleased == true  && (config == false)) {
            TS_Point p = ts.getPoint();
            if ((p.x >= 0) && (p.x <= 2500)) {
              ScreenChanged = false;
              if (num_screen != 0) {
                num_screen = num_screen - 1;
              }
              else {
                num_screen = 2;
              }
              changeScreen(num_screen);
              unsigned long currentMillis = millis();
              while (millis() < (currentMillis + debounceScreen));
            }
            else if ((p.x >= 2501) && (p.x <= 5000)) {
              ScreenChanged = false;
              num_screen = num_screen + 1;
              if (num_screen > 2) {
                num_screen = 0;
              }
              changeScreen(num_screen);
              unsigned long currentMillis = millis();
              while (millis() < (currentMillis + debounceScreen));
            }
            wasReleased = false;
          }
        }
      }
    }

  8. #83
    Just confirming sd card working by bridgeing r1,r2 and r3. I left vcc on 5v.
    Seems like those resistors are too high for the 3.3v signals from the teensy 4.0 i used.

  9. #84
    Quote Originally Posted by zike View Post
    I just got a couple of these TJCTM24028-SPI displays from PJRC and it's all "new to me."

    First, I was disappointed in the brightness: connected as recommended, with 100 Ω in series with the backlight, it only draws 20 mA total, or 5 mA per diode (there's one per edge). I believe it should be more like 20 mA per diode x 4 diodes, or 80 mA total, for nominal display brightness. The data sheet from ElectroDragon suggests the LED pin should be connected directly to 3.3VDC (there is an internal 3.9 Ω dropping resistor on the board); indeed, connected this way I measure 82 mA to the backlight, and the display looks way better.
    I got the V1.2 board and used the recommended 100 Ohms to Vin. I measure 0.38 V drop at 4.84 V, so 38 mA to the backlight LEDs. Are the LEDs in series or parallel? Do we know their current limit? A little more brightness would be nice for outdoor viewing.

  10. #85
    Oops, missed a decimal point! It's only 3.8 mA. I also tried 69 ohms and got .26 V, and 43 ohms gave .17 V. That's still just 3.8 mA and I saw no change in brightness. Wow, does the board have a current regulator?

  11. #86
    Can't find it now but I remember someone posted a schematic clip with a transistor driver for the blacklight. That would make sense if 3.8 mA is the base current, so I'm not measuring the LED current.

  12. #87
    I traced out the part of the LED circuit visible on the board. I'm not sure there are 4 LEDs nor what V+ voltage is. I measured the voltage across the 8.2 Ohm resistor as 0.40 V, so the LED current is 49 mA.

    Name:  bl.png
Views: 78
Size:  9.7 KB

    I touched other resistors parallel to the 8.2 and the backlight got brighter and the current went up, but not linearly.

    Code:
    Rp     R     V    mA
    --    -     -     --
     -    8.2   .40   49
    22    6.0   .33   55
    10    4.5   .28   62
     4.7  3.0   .21   70

Posting Permissions

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