Hi there.
I would like to add a graphic LCD to my current project (instead of the serial 2X16 already configured). I bought the parallel glcd from Seedstudio. Since my project is using pretty much all of the pins of one 328, I thought I could simply use another 328 to drive the LCD and then link them with serial communication. Problem is, I can't figure out how to configure them so that one can send the command and the other can receive it. It's probably relatively simple, but my cold seems to make my brain all muchy in the process... :-/
Thanks in advance.
Pierre.
its pretty simple you have 2 arduinos. lets call them A and B simply connect TX-A to RX-B and RX-A to TX-B. then you can send serial data to and from each other. you can even use the NewSoftSerial library on each arduino so that you can use the usb port to debug and monitor each one.
this just lets the devices talk, you still have to come up with some kind of protocol and handle the data.
simply connect TX-A to RX-B and RX-A to TX-B. then you can send serial data to and from each other.
Don't forget to connect the grounds, too.
Using NewSoftSerial and any two pins (on each chip, properly connected) is a better idea.
Thanks guys. Actually the serial hook-up was not the problem, the "protocole" is my headache.
The stuff I want to display consist of: Speed, Total distance, Battery condition and Temperature, so it's more than 1 data that I'm sending, and the "speed" is triggered with an external interrupt (with each rotation of the wheel).
Would it be simpler if I sent one "packet" of data consisting of a stream with all the variables, all the time, then separate those once on the other 328?
Or sending each variable separately, which mean, I guess, I would have to configure some kind of register to store them in the proper place before displaying.
What I try to explain is that if it's a serial LCD, you just go and type "LCD.print("hello world")" and that's it.
I've configured my GLCD with the GLCD library, and it works fine, but all I have to do is type "GLCD.print..." (you get the picture). but it's "locally" not sent through a serial link.
I mean, what do I have to do on the "receiving" 328 so this kind of syntax works? Or am I looking for stuff waaaaay over my head here?
Pierre.
p.s. For the record, I've been playing with Arduino for only a few months.
you have to build your own protocol.. A simple example would be sending a data structure over the serial wire. lets assume a simple example.
struct {
char command; // single byte command make this ascii to make things simple
uint8_t len; // data.. since this is 8 bits, we can send 0 to 255 bytes with this
uint8_t data[256] ;
} cmd;
cmd.command = 'A';
sprintf(cmd.data,"This is a test");
cmd.len = strlen(cmd.data);
Serial.write((char *)cmd,sizeof(cmd));
on the receiver, just read until you have sizeof(cmd) bytes of data into a buffer, and then typecase it to the structure ..
This should send the entire structure.. of course we are sending more than the actual command contains, but it's a simple example.
note I don;t have an arduino with me right now, so it may not be exactly perfect.
What I understand is that it's way over my head. The code you posted is complete chinese to me...
Thanks anyways.