I've connected 2 arduino boards in serial mode (tx-rx-gnd) using only one wire (tx-gnd) for data transfer.
My second arduino, which has an LCD attached to it, has to display the messages that comes from my first arduino.
The second arduino (the one with the LCD receiver) has this sketch:
In the first arduino (the one that sends the messages on the TX serial) i have this sketch:
char* myStrings[]={"apple", "orange", "banana"};
void setup(){
Serial.begin(9600);
}
void loop(){
for (int i = 0; i < 3; i++){
Serial.print(myStrings[i]);
delay(2000);
}
}
The seccond arduino with the LCD will properly display the text messages on the first line that receives from the first arduino.
Can you please tell me how get my messages displayed on the seccond line of the LCD. Like can you tell me how to get the text "banana" on the seccond line ?
That's only part of the solution. He still has to get the command to be executed, by the receiving Arduino, at the proper time. This is not impossible but it may not be trivial either.
Every command that i try to add to send my text on the second line will result in the text being send on the first line with ||| characters between the words, like the second arduino doesn't understand the concept of "new line" functions.
Every command that i try to add to send my text on the second line will result in the text being send on the first line with ||| characters between the words, like the second arduino doesn't understand the "new line" functions.
It may or may not, depending on what you mean by "the new line functions". Quit making us guess, and post your code.
Every command that i try to add to send my text on the second line will result in the text being send on the first line with ||| characters between the words, like the second arduino doesn't understand the "new line" functions.
It may or may not, depending on what you mean by "the new line functions". Quit making us guess, and post your code.
Learn to read from the top to the bottom. What you see is what you get, that is the piece of code that i have for now. Thanks.
I just want to send custom messages from my first arduino to the second one (that has an lcd). Some of the text should be on the first line and some on the second. I wrote this in my first post. I can't get the text on the second line. It's like a serial display communication.
I can read from top to bottom. There is nothing in your code that makes any attempt to print on the second line. I assumed that you had added something in response to the previous posts. If not, then you know what you need to do. If you did, and it didn't work, we have no idea what you added, so you need to post your revised code.
PaulS:
I can read from top to bottom. There is nothing in your code that makes any attempt to print on the second line. I assumed that you had added something in response to the previous posts. If not, then you know what you need to do. If you did, and it didn't work, we have no idea what you added, so you need to post your revised code.
I added, but none worked. This is why i asked for help. I want someone to help me with the commands a little.
How is the second Arduino to know that it is to display the data on the second line?
You need to send some kind of information that tells the second Arduino which line to display on. How to do this depends on the second Arduino knowing where the end of the string to display is.
You would need to send something like "1apple!2orange!1banana!".
The Arduino would read the 1st byte to know which line to write to. Then, it reads to the end of packet marker (!). If the character is not the end of packet marker, print to the LCD. If it is, you know that the next byte will be a line number, and will start the read cycle over again.
Did you forget to 'include' the Liquid Crystal library or are we just seeing part of your sketch?
I would suggest that you change the setup so that you are sending individual characters rather than strings. Then send at least 80 displayable ASACII characters across your link. This way you should see 'something' at every location on your LCD and you can verify that it is working. After that you can start counting characters and setting the cursor position.
Now, it could just be me, but it looks to me like you are telling the LiquidCrystal library that your LCD has 2 columns and 16 lines. That would indeed be a strange size/arrangement for an LCD.
This will, of course, screw up everything that deals with cursor placement.
Now, it could just be me, but it looks to me like you are telling the LiquidCrystal library that your LCD has 2 columns and 16 lines. That would indeed be a strange size/arrangement for an LCD.
The backwards notation could be a result of his using some sort of time machine to look at the older LiquidCrystal tutorials. This was fixed about 18 months ago.
This will, of course, screw up everything that deals with cursor placement.
Believe it or not this rather logical deduction is not actually what happens. The current version of the LiquidCrystal library does not use the first number (the number of columns) at all, and all it does with the second number is check to see if it is either 1 or some number that is greater than 1. So in his case the LCD should perform as expected.
What is even more unusual (about the library) than not making more use of these numbers is the fact that the library defaults to a 1 line display if there is no lcd.begin statement. This is unfortunate since virtually all the displays out there use two lines of memory, even most of the 16x1 displays (which are internally set up as 8x2).
Your code logic is not what you want to achieve. First of all, your won't display apple and banana on two lines. There is simply no logic that will move to line two after apple. Second, even if the logic works for some special inputs, which you should try to construct yourself, since you wrote the code, it won't work the next time you print apple and banana again.
Your solution: draw a flow chart of what you want the program to do, then implement the logic on the flow chart. I have another solution but I doubt you can understand with your current programming skills. So finding your flow chart and implementing would be the best approach. There is no point writing any more code with a chart.
There is no point writing any more code with a chart.
I think you meant: There is no point writing any more code without a chart. Also, the information in your flowchart should show up as the comments in your program.
Sorry floresta. My mistake. The reason I strongly suggested a chart is that I sense the OP didn't know how his/her code is running so is coding blind. I'd start with pencil and paper and have this in mind: the serial LCD arduino has no idea how many characters the sender will send so will have to handle one char at a time and keeps a count or buffer.