I am going to communicate 2 arduinos via serial communication, Arduino 1 and Arduino 2.
Arduino 2 is connected with i2c LCD , Arduino 1 has 2 push buttons for counter variables.
*The thing is that I would like to print those variables in my i2c LCD connected to Arduino 2.
*I need you help for the i2c lcd code at Arduino 2 to print with columns and rows, maybe my code isnt´the best way to do that.
Image attach Image explanation
Here is my Code for Serial Display modified for i2c LCD
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27,16,2); //
void setup() {
lcd.init();
lcd.backlight();
Serial.begin(9600);
}
void loop() {
// when characters arrive over the serial port...
if (Serial.available()) {
// wait a bit for the entire message to arrive
delay(100);
// clear the screen
lcd.clear();
// read all the available characters
while (Serial.available() > 0) {
// display each character to the LCD
lcd.write(Serial.read());
}
}
}
I use Ldmicro ladder software for my projects, I know I can use Arduino IDE but I am more familiar with ladder and doesn´t support parallel lcd only serial lcd, so here I am looking for information that nobody asks
yeah, It is close to what I want, Every time I press button 1 the counter1 encreases, like a normal counter, what I would like to achieve is to print the number of counter1 on the Arduino_2 lcd, no matter what number is, the same for button 2 with counter2 in another cursor position
yeah, but
*the counting procces is in Arduino 1 which is programmed with ladder
*The code I need is just for printing in Arduino 2 the values sent by Arduino 1
For example I send values with Arduino 1 like this: "counting_value\2\r\n
but I can´t set a cursor with my Arduino Code, I need this position because I could mix another values at LCD
thanks for yotu reply, it is because the arduino with buttons is programmed with ldmicro, a ladder software IDE, this ldmicro only support serial lcd communication. that´s why I am trying to use another arduino as a serial reader adapter to print values on lcd.
thanks for your reply, I have made this code for 2 buttons, it prints the numbers I send with each button, but I cant manage to print with set.Cursor, button 1 overlaps the value from button 2 or vice versa.
Why use the Idmicro software at all?
Or is the Idmicro doing other things apart from reading two buttons?
If you need to use two UNOs, not just connect two of the first UNO's digital outputs to two of the second UNO's digital inputs.?
No comms protocol needed, press button ONE and OUTPUT representing button one goes HIGH.
Likewise for the othe button, still uses the same number, 3, of interconnecting wires.
I uploaded a 30 seconds video demostration of overlap on youtube, I used an ESP32 instead of arduino 2 because I lent it to my friend, watch it please:
All my project are done with ldmicro, It is easy for me ladder language, for example, this is a comparison for debounce button between ldmicro and arduino:
All my logic process is en arduino 1 made with ladder, I want to print values from my ladder logic to lcd, but as ldmicro doesn´t support parallel lcd only supports serial lcd i have to use a serial reader, another arduino (arduino 2).
Please show us the format of the message being sent by the first Arduino to the second Arduino. Is there just one message per button push or is there a single message with both button push totals?
Thanks for your reply, Mr Onostech have helped us with ldmicro many times ,Yes I have, It doesn´t work for many people, It seems there is something messing at high level coding, I made my own vide tutorial years ago but it doesn´t work with new releases: