No announcement yet.

128-G2 communication issues

  • Filter
  • Time
  • Show
Clear All
new posts

  • 128-G2 communication issues

    Hi All,
    I received my 128-g2 on friday, and is since then that I'm trying to get it to work with my arduino mega2560 without any luck.

    I connected it as follow
    5V(arduino)->5V (display)
    GND (arduino)->GND (display)

    I downloaded the "Goldelox-Serial-Arduino-Library-master" that has all the libraries inside.
    Now, the code compiles and uploads to the arduino controller just fine, but the LED I connected to the pin12 keeps flashing, so I have a serial communication error.

    can somebody help me?


    here is the code I'm using:

    #define DisplaySerial Serial3 #include "Goldelox_Serial_4DLib.h"#include "Goldelox_const4D.h" //Setup communication//use software serial to communicate with the display.Goldelox_Serial_4DLib Display(&amp;DisplaySerial); //error handling routine (reduced version - see the BigDemo for the full version)//this will execute when a comms error occursvoid mycallback(int ErrCode, unsigned char Errorbyte){ // Pin 13 has an LED connected on most Arduino boards. Just give it a name #define led 12 while(1) { digitalWrite(led, HIGH); // turn the LED on (HIGH is the voltage level) delay(200); // wait for a second digitalWrite(led, LOW); // turn the LED off by making the voltage LOW delay(200); // wait for a second }} void setup() { // put your setup code here, to run once:} void loop() { int x; Serial3.begin(9600) ; Display.TimeLimit4D = 5000 ; // 2 second timeout on all commands Display.Callback4D = mycallback ; // NULL ; DisplaySerial.begin(9600) ; Display.gfx_ScreenMode(LANDSCAPE); Display.gfx_Cls(); delay(2000); Display.putstr("Hello Goldelox! \n") ; Display.txt_MoveCursor(15, 0) ; Display.putstr("Hello World! \n") ; /* //draw a waveform for(x = 0; x <= 160; x++) { Display.gfx_LineTo(x,random(128)) ; delay(50); } delay(1000); Display.gfx_Cls() ; Display.gfx_Circle(55, 13, 10, 6521); delay(4000); //Display.GetAck() ; // head Display.gfx_Line(55, 25, 55, 39, 232); delay(4000); Display.gfx_Cls() ; Display.gfx_Set(OBJECT_COLOUR, random(0xFFFF));//change colour */ }

  • #2


    The display needs some time to start up before it can respond to commands from the Arduino host. If the delay is not included in the sketch, the Mega 2560 will immediately send a command to the display module. The display may not be able to respond since it is still starting up; hence the comms error. Try inserting a five-second delay before the line DisplaySerial.begin(9600);. The attached sketch illustrates how this is done.

    Hope this helps. Attached files (2.3 KB)