Hi everyone,
I'm attempting to display a double variable from Matlab (ex. 79.95) on my LCD using Arduino. I was taking a look at the thread "Serial Input Basics" and the only way I can get it to display something even close to 79.95 is by using char. I have attached a picture of what the output looks like.
Here is my Arduino code:
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27,20,4); // set the LCD address to 0x27 for a 16 chars and 2 line display
char matlabData;
void setup()
{
lcd.begin(); // initialize the lcd
lcd.backlight();
Serial.begin(9600);
lcd.print("Heart Rate: ");
lcd.setCursor(12,0);
lcd.blink();
}
void loop()
{
// when numbers arrive over the serial port
if (Serial.available() > 0) {
matlabData=Serial.read();
lcd.print(matlabData);
}
}
Can someone please point me in the right direction?
Thank you for reading!