Wish MCUFriends_kbv library for touch screen

Discussion in 'B4R Bugs & Wishlist' started by derez, Jan 24, 2017.

  1. derez

    derez Expert Licensed User

    I have a 3.95 '' TFT which works nicely with all the examples they provide after installing these libraries:
    https://github.com/prenticedavid/MCUFRIEND_kbv
    Can you make it work in B4R as well ? I tried the above and it does not recognize the device.
    Thanks
    [​IMG]
    [​IMG]
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    Which functionality do you need? The graphics feature can probably be wrapped quite easily.
     
  3. derez

    derez Expert Licensed User

    I can't see any use except for graphics since all the pins are used by the shield...
    If you can include drawing, text, Bitmaps it will be great !
    I also tried to put it on WEMOS, changing the CS pin to A3 but it is not enough. Working with WEMOS would be great - then I'll be able to use it as the screen to the clock instead of the 1602 LCD, or as a command panel to the IOT's at home.
    So - if you can include the parts that allocate the pins to the LCD maybe it will work.
    Thank you for the efforts you invest, you should learn to say NO sometimes...
    BTW - the photos that I copied from the other thread disappeared !
     
  4. derez

    derez Expert Licensed User

    I modified the graphics example:
    upload_2017-1-25_7-32-11.png

    upload_2017-1-25_7-32-28.png
     
  5. Erel

    Erel Administrator Staff Member Licensed User

    Try the attached library.
    You need to add a reference to rAdafruitGFX library.

    The library was not tested.

    Code:
    Sub Process_Globals
       
    Public Serial1 As Serial
       
    Private mcu As MCUFRIEND_kbv
       
    End Sub

    Private Sub AppStart
       Serial1.Initialize(
    115200)
       
    Log("AppStart")
       
    Dim p As Pin 'ignore
       mcu.Initialize(p.A3, p.A2, p.A1, p.A0, p.A4)
       mcu.GFX.DrawCircle(
    101010, mcu.COLOR_GREEN, True)
    End Sub
     

    Attached Files:

    derez and Peter Simpson like this.
  6. derez

    derez Expert Licensed User

    I've just re-visited this thread, thank you Erel, it works !
    Can you tell which of the IO pins is not used by the TFT (to be able to connect to other parts/devices) ?
     
  7. Erel

    Erel Administrator Staff Member Licensed User

    I've only wrapped it so I'm not deeply familiar with the code.

    I guess that only the pins passed to the Initialize method are used.
     
  8. derez

    derez Expert Licensed User

    I have checked the printed board on the back of the screen and saw few unconnected pins.
    I connected all pins to arduino UNO by wires instead of direct plug-in, then checked the suspected pins.
    Pins 0,1,A5 are free to use !
    Now I connected a WEMOS by softserial to pins 0,1 (unable to load program when connected, so for loading - disconnect them)
    The WEMOS provides time from NIST and the UNO displays it :

    EDIT: As the WEMOS just sends data and the UNO just receives data, it is sufficient to connect just one wire from the TX pin of the wemos to RX pin of the UNO (pin D0). With that connection logic conversion is not required (the UNO reads 3.3v as high).

    clock.jpg
     
    Last edited: Aug 14, 2017 at 7:14 AM
    Erel and rbghongade like this.
  9. derez

    derez Expert Licensed User

    Additional features to the library will be useful and much appreciated:
    - get touched point, to be able to create buttons for UI by the screen.
    - Rotate to landscape.

    not that there is much space left for more code...
     
    inakigarm likes this.
  10. rbghongade

    rbghongade Active Member Licensed User

    Dear friends,
    Is there any support for touch inputs? If yes, how to to implement the same?
    regards,
    PS: this issue seems to be raised by derez!
    Probably the touch functionality needs the Touch Screen Library. The attached library for Arduino works.Hence requesting the "brains" to wrap it for B4R!
     

    Attached Files:

    Last edited: Aug 12, 2017 at 8:55 AM
  11. derez

    derez Expert Licensed User

    Final configuration and box:

    clock2.jpg

    Edit: I have implemented the daylight saving time change in the code so I don't need any buttons. Just plug it to power !
     
    Last edited: Aug 14, 2017 at 7:32 AM
Loading...