Announcement

Collapse
No announcement yet.

Sending images to GEN4-ULCD-50D over serial with Arduino examples required

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • sherwin4D
    replied
    Hi,

    Thank you for the update. Glad you've managed to solve the problem.

    Kind regards,
    Sherwin

    Leave a comment:


  • fabocode
    replied
    Hello!

    I want to give an update about this thread, thanks so much for your support, but I finally realized that the problem was that I was not selecting the appropiate display when I was setting up my 4D Workshop project.

    After I selected my desired display and also remove the code for checking for SD cards the problem was solved.


    Thanks so much for the total support.

    Leave a comment:


  • db2wings
    replied
    It was the embedded zip file for the example project. I tried it both on a windows laptop and an iPad from a hotel in Sydney, but will try it again when I get home to the states in the morning. Maybe the hotel WiFi was corrupting it, although I did unzip a couple other codebase zip files ok around the same time. Thanks

    Leave a comment:


  • ESPsupport
    replied
    That DL works fine for me, is it one of the embedded zips? What size is your download and what zip product are you using?

    Leave a comment:


  • db2wings
    replied
    FYI There's a problem with the zip file to download the code....it is corrupted SEE: AN-00100 Serial Arduino Displaying Images from the uSD Card FAT16

    https://4dsystems.com.au/blog/4d-an-00100/

    the bad zip file is in the file download section (url https://4dsystems.com.au/mwdownloads...d/link/id/644/ )

    Leave a comment:


  • sherwin4D
    replied
    Hi,

    Have you tried using AltSoftSerial? From the thread you've mention, the issue was resolved by using the library(post #43).

    All the best,
    Sherwin

    Leave a comment:


  • fabocode
    replied
    Hi,

    I tried by removing the 1k ohm resistor.

    Unfortunately this doesn't work either.

    This is the message that I am getting from the serial debugger:

    HTML Code:
    Serial 4D Library reports an error: NAK
    returned data = 21
    Program cannot proceed further. Please reset the display.

    Leave a comment:


  • sherwin4D
    replied
    Hi,

    Display module ------- Particle Photon
    5v 5v
    Tx Rx
    Rx Tx
    RESET -1KR- A5
    GND GND
    We've noticed that a resistor is connected in series on the RESET line.

    Could you please try to remove the 1k resistor and see if it works?

    Best regards,
    Sherwin

    Leave a comment:


  • fabocode
    replied
    Originally posted by fabocode View Post
    Sure!!

    However, I don't think is something related with the baudrate.
    Mostly because if I remove the TimeLimit4D definition and the callback, the display is able to draw the loop message saying "Drive not mounted...".
    Last edited by fabocode; 16 August 2019, 04:16 AM.

    Leave a comment:


  • fabocode
    replied
    Sure!!

    However, I don't think is something related with the baudrate.

    Here's my code, info and pictures of my setup:

    The connections are:

    Display module ------- Particle Photon
    5v 5v
    Tx Rx
    Rx Tx
    RESET -1KR- A5
    GND GND

    Here's the code:
    HTML Code:
    SYSTEM_MODE(MANUAL);
    #include "Diablo_Const4D.h"
    #include "Diablo_Serial_4DLib.h"
    
    #define DisplaySerial Serial1
    #define RESET_SCREEN A5
    #define ERROR_LED D7
    
    Diablo_Serial_4DLib Display(&DisplaySerial);
    
    //enable message logging
    #define LOG_MESSAGES // <-- to disable message logging, comment out this line
    #ifdef LOG_MESSAGES
    #define HWLOGGING Serial
    #else
    #define HWLOGGING if (1) {} else Serial
    #endif
    
    //global variables
    int frame = 0;
    int disk;
    word hndl;
    int iUserimages1 = 0, iUserimages2 = 1, iImage1 = 2;
    
    void setup() {
      //For handling errors
      Display.Callback4D = mycallback ;
      //5 second timeout on all commands
      Display.TimeLimit4D = 10000; // changing this value doesn't do too much, Looks like it can't go longer than 5 seconds
    #ifdef LOG_MESSAGES
      HWLOGGING.begin(9600);
      HWLOGGING.println(F("\nDisplay Images using an Arduino Host Demo w/ Message Logging"));
    #endif
    
      //--------------------------------Optional reset routine-----------------------------------
      //Reset the Display using D4 of the Arduino (if using the new 4D Arduino Adaptor - Rev 2)
      //If using the old 4D Arduino Adaptor (Rev 1), change D4 to D2 below.
      //If using jumper wires, reverse the logic states below.
      //Refer to the accompanying application note for important information.
      pinMode(RESET_SCREEN, OUTPUT); // Set D4 on Arduino to Output (4D Arduino Adaptor V2 - Display Reset)
      digitalWrite(RESET_SCREEN, 0); // Reset the Display via D4
      delay(100);
      digitalWrite(RESET_SCREEN, 1); // unReset the Display via D4
      //-----------------------------------------END---------------------------------------------
      delay (5000); //let the display start up
    
    //start
    //DisplaySerial.begin(9600) ;
    DisplaySerial.begin(200000) ;
    Display.gfx_ScreenMode(PORTRAIT);
    
    //uSD card mount routine
    Display.putstr("Mounting...\n"); //print a string
    if(!(Display.file_Mount()))
    {
      while(!(Display.file_Mount()))
      {
        Display.putstr("Drive not mounted...");
        delay(200);
        Display.gfx_Cls();
        delay(200);
      }
    }
    
      Display.gfx_BGcolour(WHITE) ; //change background color to white
      Display.gfx_Cls(); //clear the screen
    
      //load the graphics files
      hndl = Display.file_LoadImageControl("user_img.dat", "user_img.gci", 1) ;
    
      Display.img_Show(hndl,iImage1) ; //show the penguin
      Display.gfx_Set(TRANSPARENCY, ON); //turn on transparency
      Display.gfx_Set(TRANSPARENT_COLOUR, 0x3000); //make this color transparent
    
      Display.img_SetWord(hndl, iUserimages1, IMAGE_INDEX, frame) ; //where frame is 0 to 4
      Display.img_Show(hndl,iUserimages1) ; //show the left eye
    
      Display.img_SetWord(hndl, iUserimages2, IMAGE_INDEX, frame) ; // where frame is 0 to 4
      Display.img_Show(hndl,iUserimages2) ; //show the right eye
    
      Display.txt_BGcolour(WHITE); //change text background colour to white (default is black)
      Display.txt_FGcolour(BLACK); //change text foreground colour to black (default is green)
      Display.txt_MoveCursor(23, 6); //move text cursor to and start printing at row 23, col 6
    }
    
    void loop() {
      static int n = 1; //counter
    
      frame = 0; //eyes open
      Display.img_SetWord(hndl, iUserimages1, IMAGE_INDEX, frame) ; // left eye
      Display.img_Show(hndl,iUserimages1) ;
      Display.img_SetWord(hndl, iUserimages2, IMAGE_INDEX, frame) ; // right eye
      Display.img_Show(hndl,iUserimages2) ;
      Display.putstr(" Robot is happy. \r");
      delay(2000);
    
      frame = 1; //eyes closed
      Display.img_SetWord(hndl, iUserimages1, IMAGE_INDEX, frame) ; // left eye
      Display.img_Show(hndl,iUserimages1) ;
      Display.img_SetWord(hndl, iUserimages2, IMAGE_INDEX, frame) ; // right eye
      Display.img_Show(hndl,iUserimages2) ;
      delay(100);
    
      frame = 2; //eyes sad
      Display.img_SetWord(hndl, iUserimages1, IMAGE_INDEX, frame) ; // left eye
      Display.img_Show(hndl,iUserimages1) ;
      Display.img_SetWord(hndl, iUserimages2, IMAGE_INDEX, frame) ; // right eye
      Display.img_Show(hndl,iUserimages2) ;
      Display.putstr(" Robot is sad. \r");
      delay(2000);
    
      frame = 1; //eyes closed
      Display.img_SetWord(hndl, iUserimages1, IMAGE_INDEX, frame) ; // left eye
      Display.img_Show(hndl,iUserimages1) ;
      Display.img_SetWord(hndl, iUserimages2, IMAGE_INDEX, frame) ; // right eye
      Display.img_Show(hndl,iUserimages2) ;
      delay(100);
    
      frame = 3; //eyes surprised
      Display.img_SetWord(hndl, iUserimages1, IMAGE_INDEX, frame) ; // left eye
      Display.img_Show(hndl,iUserimages1) ;
      Display.img_SetWord(hndl, iUserimages2, IMAGE_INDEX, frame) ; // right eye
      Display.img_Show(hndl,iUserimages2) ;
      Display.putstr("Robot is surprised.\r");
      delay(2000);
    
      frame = 1; //eyes closed
      Display.img_SetWord(hndl, iUserimages1, IMAGE_INDEX, frame) ; // left eye
      Display.img_Show(hndl,iUserimages1) ;
      Display.img_SetWord(hndl, iUserimages2, IMAGE_INDEX, frame) ; // right eye
      Display.img_Show(hndl,iUserimages2) ;
      delay(100);
    
      frame = 4; //eyes angry
      Display.img_SetWord(hndl, iUserimages1, IMAGE_INDEX, frame) ; // left eye
      Display.img_Show(hndl,iUserimages1) ;
      Display.img_SetWord(hndl, iUserimages2, IMAGE_INDEX, frame) ; // right eye
      Display.img_Show(hndl,iUserimages2) ;
      Display.putstr(" Robot is angry. \r");
      delay(2000);
    
      frame = 1; //eyes closed
      Display.img_SetWord(hndl, iUserimages1, IMAGE_INDEX, frame) ; // left eye
      Display.img_Show(hndl,iUserimages1) ;
      Display.img_SetWord(hndl, iUserimages2, IMAGE_INDEX, frame) ; // right eye
      Display.img_Show(hndl,iUserimages2) ;
      delay(100);
    
    #ifdef LOG_MESSAGES
      HWLOGGING.print(F("\nCount = "));
      HWLOGGING.print(n);
    #endif
      n++;
    }
    
    
    //Error-handling routine
    //this will execute when a communication error occurs
    void mycallback(int ErrCode, unsigned char Errorbyte)
    {
    #ifdef LOG_MESSAGES
      const char *Error4DText[] = {
        "OK\0", "Timeout\0", "NAK\0", "Length\0", "Invalid\0" }
      ;
      HWLOGGING.print(F("Serial 4D Library reports an error: ")) ;
      HWLOGGING.print(Error4DText[ErrCode]) ;
      HWLOGGING.print(F("\n"));
    
      if (ErrCode == Err4D_NAK)
      {
        HWLOGGING.print(F("returned data = ")) ;
        HWLOGGING.println(Errorbyte) ;
      }
      else
        HWLOGGING.println(F("")) ;
    
      HWLOGGING.println(F("Program cannot proceed further. Please reset the display.")) ;
      while(1) ; // you can return here, or you can loop
    
    #else
      // Pin 13 has an LED connected on most Arduino boards. Just give it a name
      int led = ERROR_LED;
      pinMode(led, OUTPUT);
      while(1)
      {
        digitalWrite(led, HIGH); // turn the LED on (HIGH is the voltage level)
        delay(200); // wait for 200 ms
        digitalWrite(led, LOW); // turn the LED off by making the voltage LOW
        delay(200); // wait for 200 ms
      }
    #endif
    }
    Power supply: 2.4Amps - 5V DC output
    Click image for larger version  Name:	photo_2019-08-15_11-32-53 (2).jpg Views:	0 Size:	77.1 KB ID:	69319Click image for larger version  Name:	photo_2019-08-15_11-32-54.jpg Views:	0 Size:	97.8 KB ID:	69320Click image for larger version  Name:	photo_2019-08-15_11-32-55.jpg Views:	0 Size:	77.9 KB ID:	69321Click image for larger version  Name:	photo_2019-08-15_11-32-59.jpg Views:	0 Size:	92.2 KB ID:	69322Click image for larger version  Name:	photo_2019-08-15_11-32-53 (2).jpg Views:	0 Size:	77.1 KB ID:	69328Click image for larger version  Name:	photo_2019-08-15_11-32-54.jpg Views:	0 Size:	97.8 KB ID:	69329Click image for larger version  Name:	photo_2019-08-15_11-32-54.jpg Views:	0 Size:	97.8 KB ID:	69330Click image for larger version  Name:	photo_2019-08-15_11-32-55.jpg Views:	0 Size:	77.9 KB ID:	69331Click image for larger version  Name:	photo_2019-08-15_11-32-59.jpg Views:	0 Size:	92.2 KB ID:	69332Click image for larger version  Name:	photo_2019-08-15_11-32-53 (2).jpg Views:	0 Size:	77.1 KB ID:	69324Click image for larger version  Name:	photo_2019-08-15_11-32-54.jpg Views:	0 Size:	97.8 KB ID:	69325Click image for larger version  Name:	photo_2019-08-15_11-32-53 (2).jpg Views:	0 Size:	77.1 KB ID:	69326Click image for larger version  Name:	photo_2019-08-15_11-32-53 (2).jpg Views:	0 Size:	77.1 KB ID:	69327
    Attached Files
    Last edited by fabocode; 16 August 2019, 02:58 AM.

    Leave a comment:


  • sherwin4D
    replied
    Hello,

    Can you tell me if the Display needs 5v in both Rx and Tx lines of the USART communication?
    The Diablo16 pins are actually running at 3.3 volts, and is simply 5volts tolerant. Therefore, this shouldn't be an issue.

    One possible cause of the NAK error could be baudrate mismatch. Please check that both the SPE loaded to the display module runs at the same baudrate as your Particle Photon.

    Can you send a photo of your setup so we can further comment on the possible cause of this issue?

    Kind regards,
    Sherwin

    Leave a comment:


  • fabocode
    replied
    After reading a post here: https://forum.4dsystems.com.au/node/56670 I think that my problem might be that I am trying to communicate with a device (Particle Photon) that Tx and Rx lines are 3.3v but the lines that the Display requires to work with USART needs to work with 5v.

    Can you tell me if the Display needs 5v in both Rx and Tx lines of the USART communication? I have a TTL converter here (I think it works from 5v to 3.3v and vice versa)

    Leave a comment:


  • fabocode
    replied
    Hello,

    As always, thanks too much for your answers.

    I've finally found the way to make it work with my Arduino UNO. Let me provide you my finall code snipped.

    HTML Code:
    /*
     * Project diablo16_test
     * Description:
     * Author:
     * Date:
     */
    //SYSTEM_MODE(MANUAL);
    #include "Diablo_Const4D.h"
    #include "Diablo_Serial_4DLib.h"
    //#include <SoftwareSerial.h>
    
    //#define DisplaySerial Serial1
    #define DisplaySerial Serial
    //SoftwareSerial DisplaySerial(10, 11);
    #define RESET_SCREEN 4
    
    Diablo_Serial_4DLib Display(&DisplaySerial);
    
    //enable message logging
    //#define LOG_MESSAGES  // <-- to disable message logging, comment out this line
    #ifdef LOG_MESSAGES
    #define HWLOGGING Serial
    #else
    #define HWLOGGING if (1) {} else Serial
    #endif
    
    //global variables
    int frame = 0;
    int disk;
    word hndl;
    int iUserimages1 = 0, iUserimages2 = 1, iImage1 = 2;
    
    void setup() {
      //For handling errors
      //Display.Callback4D = mycallback ;
    
      //5 second timeout on all commands  
      //Display.TimeLimit4D   = 5000 ;
    
    #ifdef LOG_MESSAGES
      HWLOGGING.begin(115200);
      HWLOGGING.println(F("\nDisplay Images using an Arduino Host Demo w/ Message Logging"));
    #endif
    
      //--------------------------------Optional reset routine-----------------------------------
      //Reset the Display using D4 of the Arduino (if using the new 4D Arduino Adaptor - Rev 2)
      //If using the old 4D Arduino Adaptor (Rev 1), change D4 to D2 below.
      //If using jumper wires, reverse the logic states below. 
      //Refer to the accompanying application note for important information.
      pinMode(RESET_SCREEN, OUTPUT);  // Set D4 on Arduino to Output (4D Arduino Adaptor V2 - Display Reset)
      digitalWrite(RESET_SCREEN, 0);  // Reset the Display via D4
      delay(100);
      digitalWrite(RESET_SCREEN, 1);  // unReset the Display via D4
      //-----------------------------------------END---------------------------------------------
    
      delay (5000); //let the display start up  
    
      //start
      //DisplaySerial.begin(9600) ;
      DisplaySerial.begin(200000) ; 
      Display.gfx_ScreenMode(PORTRAIT);
    
      //uSD card mount routine
      Display.putstr("Mounting...\n");  //print a string
      if(!(Display.file_Mount()))
      {
        while(!(Display.file_Mount()))
        {
          Display.putstr("Drive not mounted...");
          delay(200);
          Display.gfx_Cls();
          delay(200);
        }
      }
    
      Display.gfx_BGcolour(WHITE) ; //change background color to white
      Display.gfx_Cls();            //clear the screen
    
      //load the graphics files
      hndl = Display.file_LoadImageControl("user_img.dat", "user_img.gci", 1) ;
    
      Display.img_Show(hndl,iImage1) ;               //show the penguin
      Display.gfx_Set(TRANSPARENCY, ON);             //turn on transparency
      Display.gfx_Set(TRANSPARENT_COLOUR, 0x3000);   //make this color transparent
    
      Display.img_SetWord(hndl, iUserimages1, IMAGE_INDEX, frame) ; //where frame is 0 to 4
      Display.img_Show(hndl,iUserimages1) ;                         //show the left eye
    
      Display.img_SetWord(hndl, iUserimages2, IMAGE_INDEX, frame) ; // where frame is 0 to 4
      Display.img_Show(hndl,iUserimages2) ;                         //show the right eye
    
      Display.txt_BGcolour(WHITE); //change text background colour to white (default is black)
      Display.txt_FGcolour(BLACK); //change text foreground colour to black (default is green)
      Display.txt_MoveCursor(23, 6); //move text cursor to and start printing at row 23, col 6
    
    }
    
    void loop() { 
      static int n = 1;  //counter 
    
      frame = 0;   //eyes open
      Display.img_SetWord(hndl, iUserimages1, IMAGE_INDEX, frame) ; // left eye
      Display.img_Show(hndl,iUserimages1) ;
      Display.img_SetWord(hndl, iUserimages2, IMAGE_INDEX, frame) ; // right eye
      Display.img_Show(hndl,iUserimages2) ;
      Display.putstr("  Robot is happy.  \r");
      delay(2000);
    
      frame = 1;   //eyes closed
      Display.img_SetWord(hndl, iUserimages1, IMAGE_INDEX, frame) ; // left eye
      Display.img_Show(hndl,iUserimages1) ;
      Display.img_SetWord(hndl, iUserimages2, IMAGE_INDEX, frame) ; // right eye
      Display.img_Show(hndl,iUserimages2) ;
      delay(100);
    
      frame = 2;   //eyes sad
      Display.img_SetWord(hndl, iUserimages1, IMAGE_INDEX, frame) ; // left eye
      Display.img_Show(hndl,iUserimages1) ;
      Display.img_SetWord(hndl, iUserimages2, IMAGE_INDEX, frame) ; // right eye
      Display.img_Show(hndl,iUserimages2) ;
      Display.putstr("   Robot is sad.   \r");
      delay(2000);
    
      frame = 1;  //eyes closed
      Display.img_SetWord(hndl, iUserimages1, IMAGE_INDEX, frame) ; // left eye
      Display.img_Show(hndl,iUserimages1) ;
      Display.img_SetWord(hndl, iUserimages2, IMAGE_INDEX, frame) ; // right eye
      Display.img_Show(hndl,iUserimages2) ;
      delay(100);
    
      frame = 3;   //eyes surprised
      Display.img_SetWord(hndl, iUserimages1, IMAGE_INDEX, frame) ; // left eye
      Display.img_Show(hndl,iUserimages1) ;
      Display.img_SetWord(hndl, iUserimages2, IMAGE_INDEX, frame) ; // right eye
      Display.img_Show(hndl,iUserimages2) ;
      Display.putstr("Robot is surprised.\r");
      delay(2000);
    
      frame = 1;  //eyes closed
      Display.img_SetWord(hndl, iUserimages1, IMAGE_INDEX, frame) ; // left eye
      Display.img_Show(hndl,iUserimages1) ;
      Display.img_SetWord(hndl, iUserimages2, IMAGE_INDEX, frame) ; // right eye
      Display.img_Show(hndl,iUserimages2) ;
      delay(100);
    
      frame = 4;   //eyes angry
      Display.img_SetWord(hndl, iUserimages1, IMAGE_INDEX, frame) ; // left eye
      Display.img_Show(hndl,iUserimages1) ;
      Display.img_SetWord(hndl, iUserimages2, IMAGE_INDEX, frame) ; // right eye
      Display.img_Show(hndl,iUserimages2) ;
      Display.putstr("  Robot is angry.  \r");
      delay(2000);
    
      frame = 1;  //eyes closed
      Display.img_SetWord(hndl, iUserimages1, IMAGE_INDEX, frame) ; // left eye
      Display.img_Show(hndl,iUserimages1) ;
      Display.img_SetWord(hndl, iUserimages2, IMAGE_INDEX, frame) ; // right eye
      Display.img_Show(hndl,iUserimages2) ;
      delay(100);   
    
    #ifdef LOG_MESSAGES
      HWLOGGING.print(F("\nCount = "));
      HWLOGGING.print(n);
    #endif
      n++;
    }
    
    //Error-handling routine
    //this will execute when a communication error occurs
    void mycallback(int ErrCode, unsigned char Errorbyte)
    {
    #ifdef LOG_MESSAGES
      const char *Error4DText[] = {
        "OK\0", "Timeout\0", "NAK\0", "Length\0", "Invalid\0"  } 
      ;
      HWLOGGING.print(F("Serial 4D Library reports an error: ")) ;
      HWLOGGING.print(Error4DText[ErrCode]) ;
      HWLOGGING.print(F("\n"));
    
      if (ErrCode == Err4D_NAK)
      {
        HWLOGGING.print(F("returned data = ")) ;
        HWLOGGING.print(Errorbyte) ;
      }
      else
        HWLOGGING.println(F("")) ;
    
      HWLOGGING.println(F("Program cannot proceed further. Please reset the display.")) ;
      while(1) ; // you can return here, or you can loop
    
    #else
      // Pin 13 has an LED connected on most Arduino boards. Just give it a name
      int led = 13;
      pinMode(led, OUTPUT);
      while(1)
      {
        digitalWrite(led, HIGH);   // turn the LED on (HIGH is the voltage level)
        delay(200);                // wait for 200 ms
        digitalWrite(led, LOW);    // turn the LED off by making the voltage LOW
        delay(200);                // wait for 200 ms
      }
    #endif
    }

    I realized that the demo (and I think everytime you work with this library) that you need to setup a callback for errors and a time limit to define that error. Specifically the lines
    HTML Code:
      //For handling errors
      Display.Callback4D = mycallback ;
    
      //5 second timeout on all commands  
      Display.TimeLimit4D   = 5000 ;
    At first, I decided to remove them but after leaving them, and I've found that this is required to get a better image performance by the display.

    Without the TimeLimit4D setup, the code can work drawing some stuff but in a worst way, you have to handle it to make it work as you want. And also the SD card readings will give an error and will not going to work. It simply keeps in a while loop putting "Drive not mounted..." and resetting. So it's something very important.

    Now that I have this code working nicely on my Arduino UNO. I wanted to reproduce the same result in my Particle Photon. I pasted the same code and I've found that it's not working, I setup the HWLOGGIN in the serial monitor and this was the output from the debugger:
    "Serial 4D Library reports an error: NAK
    returned data = 21Program cannot proceed further. Please reset the display."


    And when I decided to remove the lines for the callback and the TimeLimit and I've found that I have the same result as the Arduino without that lines of code. I get the while loop putting "Drive not mounted..." and resetting.

    So my question is... According to the information that I've provided. How could I solve this problem running on my Particle Photon? Is it possible that the TimeLimit isn't working on my photon?

    Leave a comment:


  • sherwin4D
    replied
    Hi,

    I get a printed message stating that there is no SD card mounted in the display. Is it possible that
    do not have the SD card requirements and I need another SD card to do it?
    It's one of the possibilities because not all uSD Card has SPI support. However, we noticed that your *.dat and
    *.gci files exceeded the allowed maximum 12 characters(8 characters for the name plus 4 characters for the file
    extension) file name for your graphics files.

    In addition to that, could you please check if the file names of your generated graphics files matches that with what
    is within your ViSi code? See photo below:
    Click image for larger version

Name:	Capture1.PNG
Views:	248
Size:	9.0 KB
ID:	69227

    If this doesn't solve the issue, it would help a lot if you could post pictures of your setup.

    I hope this helps. Should you have other concerns feel free to ask.

    Good luck and best regards,
    Sherwin

    Leave a comment:


  • fabocode
    replied
    Hello,

    Thank you for your response!

    I started to give it a try to the documentation that you provided.

    However, I've been trying with the following code and I am unable to be able to detect my SD card by the display.

    I get a printed message stating that there is no SD card mounted in the display. Is it possible that do not have the SD card requirements and I need another SD card to do it?

    I will attach the code and the SD card information just for clearance for my issue.

    Thanks.

    HTML Code:
    #include "Diablo_Const4D.h"
    #include "Diablo_Serial_4DLib.h"
    #include <SoftwareSerial.h>
    
    
    SoftwareSerial DisplaySerial(10, 11);
    
    #define RESET_SCREEN 4
    
    Diablo_Serial_4DLib Display(&DisplaySerial);
    
    //global variables
    int frame = 0;
    int disk;
    word hndl;
    int iUserimages1 = 0, iUserimages2 = 1, iImage1 = 2;
    
    
    void uSD() {
    
      if(!(Display.file_Mount()))
      {
        while(!(Display.file_Mount()))
        {
          Display.putstr("Drive not mounted...");
          delay(200);
          Display.gfx_Cls();
          delay(200);
        }
      }
    
      //Display.gfx_BGcolour(WHITE) ; //change background color to white
      //Display.gfx_Cls();            //clear the screen
    }
    
    void setupDisp() {
      pinMode(RESET_SCREEN, OUTPUT);
      digitalWrite(RESET_SCREEN, 0);
      delay(100);
      digitalWrite(RESET_SCREEN, 1);
      delay(1000);
      DisplaySerial.begin(200000);
      //Display.gfx_ScreenMode(LANDSCAPE_R);
      Display.gfx_ScreenMode(PORTRAIT);
      //Display.txt_Set(FONT_ID, FONT_4);        // Set the type font
      //Display.txt_Set(TEXT_BOLD, ON);          // set Bold text
      Display.txt_Set(TEXT_COLOUR, WHITE);     // set Bold text
      Display.txt_Width(2);     // set Bold text
      Display.txt_Height(2);     // set Bold text
    }
    
    void startDisp() {
      Display.txt_MoveCursor(0, 0);  
      Display.putstr("hello in arduino");
      delay(100);
    }
    
    // setup() runs once, when the device is first turned on.
    void setup() {
    
      setupDisp();
    }
    
    // loop() runs over and over again, as quickly as it can execute.
    void loop() {
    
      //startDisp();
      uSD();
    }
    Click image for larger version

Name:	asdcard2.PNG
Views:	174
Size:	13.5 KB
ID:	69216
    Click image for larger version

Name:	sdcard.PNG
Views:	174
Size:	19.4 KB
ID:	69217
    Attached Files

    Leave a comment:

Working...
X