Announcement

Collapse
No announcement yet.

OLED-96-G2 with Arduino Mega Images won't display

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

  • OLED-96-G2 with Arduino Mega Images won't display

    I have an application that needs to display images on queue from code from an Arduino Mega. I have loaded the images and pasted the code as per the documentation through Visi. Thirteen images, one per form, thus thirteen forms. However, a simple test program, included below, to swap between at least two of the images, does absolutely nothing. What am I missing here? I have made sure the wiring is correct as well, i.e. "RX" from Mega goes to "TX" on the screen, etc. Bottom line, it just keeps displaying the last picture. pic13 form 13.

    Arduino Mega test code:
    #include <Goldelox_Const4D.h>
    #include <Goldelox_Const4DSerial.h>
    #include <Goldelox_Serial_4DLib.h>
    #include <Goldelox_Types4D.h>

    #define DisplaySerial Serial1

    Goldelox_Serial_4DLib Display(&DisplaySerial);
    int reset = 4;

    void setup() {
    DisplaySerial.begin(9600);
    Display.media_Init();
    }

    void loop() {
    DisplaySerial.begin(9600);
    Display.media_Init();

    Display.gfx_Cls();
    Display.media_SetAdd(2, 0x4600);
    Display.media_Image(0,0);
    delay(250);
    Display.media_SetAdd(0, 0x0000);
    Display.media_Image(0, 0);
    delay(250);

    }

    4DGL Code:
    #platform "GOLDELOX"

    // Program Skeleton 1.0 generated 10/21/2016 6:44:20 PM

    #inherit "4DGL_16bitColours.fnc"

    #inherit "VisualConst.inc"

    #inherit "TheClock2SymbolsConst.inc"

    func main()
    // Uncomment the following if uSD images, fonts or strings used.
    print("Starting\n") ;
    while(!media_Init())
    putstr("Drive not mounted...");
    pause(200);
    gfx_Cls();
    pause(200);
    wend


    // Image1 1.0 generated 10/22/2016 9:12:56 AM
    media_SetAdd(iImage1H, iImage1L) ; // point to the Image1 image
    media_Image(0, 0) ; // show image


    // Image2 1.0 generated 10/22/2016 9:13:05 AM
    media_SetAdd(iImage2H, iImage2L) ; // point to the Image2 image
    media_Image(4, 1) ; // show image


    // Image3 1.0 generated 10/22/2016 9:13:16 AM
    media_SetAdd(iImage3H, iImage3L) ; // point to the Image3 image
    media_Image(1, 0) ; // show image


    // Image4 1.0 generated 10/22/2016 9:13:28 AM
    media_SetAdd(iImage4H, iImage4L) ; // point to the Image4 image
    media_Image(1, 1) ; // show image


    // Image5 1.0 generated 10/22/2016 9:13:38 AM
    media_SetAdd(iImage5H, iImage5L) ; // point to the Image5 image
    media_Image(2, 0) ; // show image


    // Image6 1.0 generated 10/22/2016 9:13:45 AM
    media_SetAdd(iImage6H, iImage6L) ; // point to the Image6 image
    media_Image(2, 1) ; // show image

    // Image7 1.0 generated 10/22/2016 9:14:00 AM
    media_SetAdd(iImage7H, iImage7L) ; // point to the Image7 image
    media_Image(0, 0) ; // show image

    // Image8 1.0 generated 10/22/2016 9:14:14 AM
    media_SetAdd(iImage8H, iImage8L) ; // point to the Image8 image
    media_Image(0, 1) ; // show image

    // Image9 1.0 generated 10/22/2016 9:14:18 AM
    media_SetAdd(iImage9H, iImage9L) ; // point to the Image9 image
    media_Image(2, 0) ; // show image

    // Image10 1.0 generated 10/22/2016 9:14:22 AM
    media_SetAdd(iImage10H, iImage10L) ; // point to the Image10 image
    media_Image(0, 0) ; // show image

    // Image11 1.0 generated 10/22/2016 9:14:24 AM
    media_SetAdd(iImage11H, iImage11L) ; // point to the Image11 image
    media_Image(0, 0) ; // show image

    // Image12 1.0 generated 10/22/2016 9:14:27 AM
    media_SetAdd(iImage12H, iImage12L) ; // point to the Image12 image
    media_Image(1, 0) ; // show image

    // Image13 1.0 generated 10/22/2016 9:14:30 AM
    media_SetAdd(iImage13H, iImage13L) ; // point to the Image13 image
    media_Image(0, 0) ; // show image


    repeat
    forever
    endfunc


    The constants associated with the images High and Low words:
    #CONST
    iImage1H 0x0000
    iImage1L 0x0000
    iImage2H 0x0000
    iImage2L 0x3200
    iImage3H 0x0000
    iImage3L 0x6000
    iImage4H 0x0000
    iImage4L 0x9000
    iImage5H 0x0000
    iImage5L 0xC000
    iImage6H 0x0000
    iImage6L 0xF000
    iImage7H 0x0001
    iImage7L 0x2000
    iImage8H 0x0001
    iImage8L 0x5200
    iImage9H 0x0001
    iImage9L 0x8200
    iImage10H 0x0001
    iImage10L 0xB200
    iImage11H 0x0001
    iImage11L 0xE400
    iImage12H 0x0002
    iImage12L 0x1600
    iImage13H 0x0002
    iImage13L 0x4600
    Inputs 0
    #END

  • #2
    Hi dtmacdonald

    If I get your question correctly, you want to display images loaded unto the microSD card (inside the Display Module) and the commands to change/display the images are coming from the Arduino Mega via serial comms?

    The code that you made in Arduino Mega is for the Serial Environment and not for the ViSi Environment.The ViSi environment is for using the Display module as a standalone microcontroller, or you can create subroutine functions that will be executed when it receives serial commands from the Arduino Mega.

    As a solution to your problem, and also because the code you made in Arduino Mega is for the Serial Environment, the implementation for this is different, you can learn more about that through this application note:

    Serial Goldelox Getting Started - The SPE Application:
    http://www.4dsystems.com.au/appnote/4D-AN-00086/

    Serial Connection to an Arduino Host:
    http://www.4dsystems.com.au/appnote/4D-AN-00092/

    Serial Arduino Displaying Images from the uSD Card RAW:
    http://www.4dsystems.com.au/appnote/4D-AN-00134/

    Serial Displaying Images from the uSD Card RAW:
    http://www.4dsystems.com.au/appnote/4D-AN-00085/

    I hope this helps.

    Comment

    Working...
    X