Hello all, I'm new to using arduino and this forum as well. I haven't had any experience with programming other than starting with the arduino about 2 months ago. This is the project im working on: One arduino needs to collect data from 3 pressure sensors and transmit those values wirelessly to another arduino that has an LCD attached(this micro will print the values). Just to start with, I've connected a potentiometer to one arduino, and have the second set up to try to print that value. Both arduinos have xbee shields with xbee pros.
The issue im having is that the second LCD arduino isnt printing out a whole number at once (ex: 3.45) then changing; its printing one character at a time (ex: 3 (lcd clears), . (lcd clears), 4 (lcd clears), 5 (lcd clears). Im having a rough time getting over this hurdle, any and all help is greatly appreciated!!
Here is my code:
1st Arduino (collects analog data from potentiometer and transmits it):
void setup() {
Serial.begin(9600);
}
void loop() {
int sensorValue = analogRead(A0);
float voltage = sensorValue*(5/1023);
Serial.print(voltage);
Serial.println(voltage);
}
2nd Arduino (Recieves data, prints to LCD)
#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
int voltage;
void setup() {
Serial.begin(9600);
lcd.begin(16, 2);
lcd.print("Created By:");
lcd.setCursor(0, 1);
lcd.print("My name");
delay(3000);
}
void loop() {
lcd.clear();
if (Serial.available() > 0) {
voltage =(Serial.read());
lcd.print(char(voltage));
}
Serial.println(char(voltage));
delay(1000);
}