How do i break it up? hhaha im sorry im not good at thisFirst off was it showing up now on the LCD you have to send a byte at time so you break it up into bytes
- Serial.println(1.23456, 4) gives "1.2346"
Try this
C:void loop() { if(Serial.available() > 0) { val=Serial.read(); lcd.setCursor (i,0); lcd.print(val); if(++i >= 16)i = 0; i get 5115 each time i press the button }
"123.4578" is sent one character at a time. It has 8 characters. So, a buffer of 9 will do. Read is using serial interrupt and send it to lcd.print().That's because I don't think Jay understands you did the math on the sending side when you add 1.0 that set's the size
Serial.print sends it out one byte at a time. If it's 6 byte it send them all.
Now what you need to do is send the number out raw and on the receiving side do the math
#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
void setup() {
Serial.begin(38400);
lcd.begin(16, 2);
}
void loop()
{
if(Serial.available() > 0)
{
lcd.clear();
float x = Serial.read();
float y = x * (5.0/1023.0);
lcd.setCursor(0, 1);
lcd.print(y);
delay(2000);
}
}
int val;
#define button 3
void setup() {
Serial.begin(38400);
pinMode(button , INPUT);
}
void loop() {
val = digitalRead(button);
if (val == HIGH)
{
int sensor = analogRead(A0);
int voltage0 = sensor;
Serial.println(voltage0);
delay(500);
}
}