Hi I have a quick quesiton I have a soil sensor on an Arduino Mega. And that Arduino Mega is wired connected to an Arduino Uno. On the uno, I have a 16x2 LCD Display. So I was trying to get a reading from one soil sensor to display the number on the Lcd on the other Arduino. But when I try my current code I can't get a continuous reading on my LCD.
Here is my Mega code
`#include <Wire.h>
int msensor=2;
int x=0;
int receiveEvent;
void setup() {
Wire.begin();
Serial.begin(9600);
pinMode(msensor, INPUT);
Wire.onReceive(receiveEvent);
}
why are you using mega and uno both ? and you should use pwm pin or analog pin for msensor. if you are getting data on lcd but that is not continuous you should check your wiring connections.
i am using 2 because I'm trying to make a remote control type of thing its complicated. And I tried analog pin before too and it doesn't work the right way. I wanted to get the lcd to update they number every time I get a new value. I also tested both components and they both work, but when combining them they don't seem to work as intended.
Cross-posting is against the Arduino forum rules. The reason is that duplicate posts can waste the time of the people trying to help. Someone might spend a lot of time investigating and writing a detailed answer on one topic, without knowing that someone else already did the same in the other topic.
Repeated cross-posting can result in a suspension from the forum.
In the future, please only create one topic for each distinct subject matter. This is basic forum etiquette, as explained in the "How to get the best out of this forum" guide. It contains a lot of other useful information. Please read it.
I2c is short of "inter integrated circuits", it designed to connect devices on the same PCB, and works on short distances only.
Guaranteed distance for i2c connection is no more than 30cm
Edition: I am blind tomorrow, I read your "8 in" as "8m"
I still not understanding what the point to use a two arduinos. Remote control for 8 in? Really?
Do you separate the sensor reading and display because you have a trouble to manage them in the same code?