Hi nos804
Sorry, the library I had on my PC was actually a pre-release one, and it was modified for release.
The github library is correct.
Please refer to the example that comes with it called "Display_print". This replaced the "putstr" demo I pasted above.
I hope that helps
Regards
Announcement
Collapse
No announcement yet.
Display always times out.
Collapse
X
-
I found my issue. I had previously been working with visi-genie. I never actually flashed the serial environment back to the display.
I have the big demo example working now. I apologize for the inconvenience. Still trying to get the environment figured out.
Although as far as your code goes, I pulled the D16 library from https://github.com/4dsystems/Diablo1...rduino-Library and when I try to run your code I get compile errors on the Display.putstr commands for to many arguments. Are you running a special library, or did I pull from the wrong git?
Leave a comment:
-
Hi nos804
I just set up a Mega2560 and a Diablo 4.3", programmed with SPE, and I used the 'putstr' demo which ships with the Diablo Serial Library, and its working fine...
I used Serial1 to talk to the Display, and had the jumper wires like your photo, but put into TX1 and RX1 instead.
Here is the code I used:
Code://Simple Demo that demonstrates 'putstr' new functionality. #define DisplaySerial Serial1 //-------DIABLO16 DISPLAYS------- #include <Diablo_Const4D.h> #include <Diablo_Serial_4DLib.h> //use Serial1 to communicate with the display. Diablo_Serial_4DLib Display(&DisplaySerial); //---------END----------------- void setup() { DisplaySerial.begin(9600) ; //--------------------------------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(4, OUTPUT); // Set D4 on Arduino to Output (4D Arduino Adaptor V2 - Display Reset) digitalWrite(4, 1); // Reset the Display via D4 delay(100); digitalWrite(4, 0); // unReset the Display via D4 //-----------------------------------------END--------------------------------------------- delay (5000); //let the display start up Display.gfx_ScreenMode(PORTRAIT); //Display.gfx_BGcolour(WHITE) ; //change background color to white Display.gfx_Cls(); //clear the screen //putstr demo int a = 1; long b = 2345; float c = 6.7899; long d = 10; Display.putstr("TEST \n"); //prints string Display.putstr(0); //prints int only Display.putstr("\n");//prints newline Display.putstr(a, "\n");//prints int with newline(can be any string like "\r") Display.putstr(b); //prints long only Display.putstr("\n");//prints newline Display.putstr(b, "\n");//prints long with newline(can be any string like "\r") Display.putstr(5, 2); //prints 5 in base 2 format(binary) 101 only, can be DEC(10), HEX(16), OCT(8), BIN(2) Display.putstr("\n");//prints newline Display.putstr(d, HEX, "\n"); //prints 10 in base 16 format(hexadecimal) with newline(can be any string like "\r") Display.putstr(1.23456); //prints 1.23 only, 2 decimal places by default Display.putstr("\n"); Display.putstr(c, 3, " \r");// prints 6.790(rounded) with 3 decimal places and with " \r" /* OUTPUT: TEST 0 1 2345 2345 101 A 1.23 6.790 */ } void loop() { }
Does it state 9600 baud rate, or have you changed this in options at some point?
While typing, I just changed it to use software serial, and wired it exactly as you have it. This also works
Here is my code for that:
Code://Simple Demo that demonstrates 'putstr' new functionality. #include <SoftwareSerial.h> SoftwareSerial mySerial(10, 11); // RX, TX #define DisplaySerial mySerial //-------DIABLO16 DISPLAYS------- #include <Diablo_Const4D.h> #include <Diablo_Serial_4DLib.h> //use Software Serial to communicate with the display. Diablo_Serial_4DLib Display(&DisplaySerial); //---------END----------------- void setup() { DisplaySerial.begin(9600) ; //--------------------------------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(4, OUTPUT); // Set D4 on Arduino to Output (4D Arduino Adaptor V2 - Display Reset) digitalWrite(4, 1); // Reset the Display via D4 delay(100); digitalWrite(4, 0); // unReset the Display via D4 //-----------------------------------------END--------------------------------------------- delay (5000); //let the display start up Display.gfx_ScreenMode(PORTRAIT); //Display.gfx_BGcolour(WHITE) ; //change background color to white Display.gfx_Cls(); //clear the screen //putstr demo int a = 1; long b = 2345; float c = 6.7899; long d = 10; Display.putstr("TEST \n"); //prints string Display.putstr(0); //prints int only Display.putstr("\n");//prints newline Display.putstr(a, "\n");//prints int with newline(can be any string like "\r") Display.putstr(b); //prints long only Display.putstr("\n");//prints newline Display.putstr(b, "\n");//prints long with newline(can be any string like "\r") Display.putstr(5, 2); //prints 5 in base 2 format(binary) 101 only, can be DEC(10), HEX(16), OCT(8), BIN(2) Display.putstr("\n");//prints newline Display.putstr(d, HEX, "\n"); //prints 10 in base 16 format(hexadecimal) with newline(can be any string like "\r") Display.putstr(1.23456); //prints 1.23 only, 2 decimal places by default Display.putstr("\n"); Display.putstr(c, 3, " \r");// prints 6.790(rounded) with 3 decimal places and with " \r" /* OUTPUT: TEST 0 1 2345 2345 101 A 1.23 6.790 */ } void loop() { }
Let me know what you find
Regards
Leave a comment:
-
I have the baud set to 9600. I have tried both software serial and multiple serial ports on the Arduino Mega.
When i monitor the serial port the 2 examples I am using, Serial touch detection and display_print, give me an umlauted y and B every time.
Leave a comment:
-
If you are using software serial you should also use a low baud rate (<36kb IIRC) as software serial is not reliable at high baud rates.
Do you have some way of monitoring the serial port?
You could try the sample, File, Samples, Picaso Designer, Picaso - Serial Comms, Serial. This will echo received serial to the display.
Can you include a photo of your setup so we can see if everything is wired up correctly
Leave a comment:
-
Display always times out.
I have been trying to get communication between an arduino and the 4.3 inch diablo display, and have had no such luck so far. I have been trying the serial connection and touch detection examples. I am using software serial on ports 10 and 11, and I have jumped those to J3 and J4 on the shield respectively. I have tested the simulated serial ports and they are behaving appropriately, but no matter what the examples always return "Serial 4D Library reports error Timeout".
The display communicates with the 4D workshop program with no issue.
Are there any siggestions on how to get this working?Tags: None
Leave a comment: