Hello,
I have this GLCD to a Arduino Mega. It turns on and I can send simple commands. I found a quick sample that works using the Wire.h. The problem is the way the commands are sent. There is no problem converting the commands to bytes when it is a one for one. It is kinda hard to explain here is the sample code that I found:
I found it here
So pretty much you have to send 0x11 fist all the time, then the size, then ESC then the commands. Here is the manual link:
Notice on page 10 they have some example that makes no sense to me. All I just need to know is how they got those HEX numbers there
the sample command is
<DC1> len ESC D L ESC G D 0 0 479 271 bcc
$11 $0E $1B $44 $4C $1B $47 $44 $00 $00 $00 $00 $DF $01 $0FE $01 $6
so for each 0 they put 2 $00
for 479 they put $DF $01
and for 271 $0FE $01
I have a function that I wrote that takes the string command and gets each character and turns it to a bytes.
This works great sendData("DL", true);
But, it messes up when I try the example "ESCGD00479271"
Even If I was to break out each segment how do I figure out the size.
Any help would be greatly appreciated.
Thanks,
-Martin
Moderator edit: [code] ... [/code] tags added. (Nick Gammon)
Just in case it might help anyone.
I found out what is going on with sending numbers. Apparently it sends numbers broken out into 2 parts of 2 hex numbers and backwards. For example: 479 decimal is 1DF HEX
But it send it $DF then $01.
It took me a while to finally see it, I'm just happy I understand whats going on now.
I will post the method I am working on that will send the commands correctly once it is finish.
I just have one issue with sending multiple commands. I have posted a question in the connection section where the I2C stuff is because I think it has to do with that. Unless it is the GLCD who is limited to only one command, I need to check it out.
mjsalinas:
I just have one issue with sending multiple commands. I have posted a question in the connection section where the I2C stuff is because I think it has to do with that. Unless it is the GLCD who is limited to only one command, I need to check it out.
Thanks for the help.
The main problem I am having is that I would like to send multiple commands to the screen.
For example:
1.Clear the screen
2.Display a menu
3. Change the menu option selected
4. Change the screen once an option is selected.
...
I modified my code with what you suggested but it does the same thing. It only seems to execute the first command.
Thanks much Nick,
That seems to do it. I put a Serial.println(foo); and I get the 6 that the documentation says it should be returning for both commands. It clears the screen then draws the line, or if I flip them it draws the line then clears the screen.
BTW, I see what you mean about the
In the documentation under the I2C stuff it says
all pins open: Write $DE
Read $DF
I didn't know how this stuff works, so I assumed to read from it must get it from that address.
Thanks for the help, it is much appreciated.
-Martin