5110LCD displaying garbage

Good morning,
This is my first post after lurking for almost a year and learning what I can.

I am trying to create a remote temperature sensing and reading unit with some nRF240L+, Nokia 5110 display and an Uno or three. I used as a sketch (http://educ8s.tv/arduino-wireless-weather-station/) to adapt and adjust as I dont have a nice a big 3.2” Color TFT display and DS3231 real time clock. So I will make do with a Nokia 5110 LCD and a 16x2 LCD on 2 different Unos.

The transmitter sketch works well and I get the Temp and Hum data displayed on the 16x2 LCD receiver Uno, the data comes through on the serial monitor same as what it does on the LCD and this works.

My problem is getting it displayed on the Nokia 5110 display. It displays garbage as indicated on the attached adjusted Fritzing diagram. The data on the serial monitor comes through fine, but all the 5110 gives me is headaches and more garbage.

I have tried countless reiterations of the code and tried numerous different ways of getting the temp and hum displayed but to no avail. Google, is my friend, but it is also my foe. There is so much information out there, that I quickly get side tracked and lost more than what I was in the beginning.

I realise that I am ignorant and more than likely a bit on the slow side, so please take it easy on me :slight_smile:
Your assistance, guidance and direction is greatly appreciated.

My code is as follows:

    /////////////////////////////////////////////////////////////////
   //         Arduino Wireless Weather Station v1.01              //
  //       Get the latest version of the code here:              //
 //    http://educ8s.tv/arduino-wireless-weather-station/       //
/////////////////////////////////////////////////////////////////


//#include "DHT.h"
#include "RF24.h"
#include "LCD5110_Graph.h"

//#define DHTPIN A1 
//#define DHTTYPE DHT22 
//DHT dht(DHTPIN, DHTTYPE);

LCD5110 lcd(7,6,5,4,3);// Nokia 5110 LCD module connections (CLK, DIN, D/C, CE, RST)
extern unsigned char SmallFont[];
//extern unsigned char TinyFont[];

RF24 myRadio (9, 8);
byte addresses[][6] = {"0"};

struct package
{
  float temperature;
  float temp;
  float humidity;
  float hum;

};
 int remoteTemperature;
 int remoteHumidity;
 int remoteTemp; 
 int remoteHum;

 
typedef struct package Package;
Package data;

void setup() {

  Serial.begin(9600);
  lcd.InitLCD();
//  dht.begin();
  delay(2000);
  startWirelessCommunication();
 //PrintingUI ();
}
void loop() {
   checkForWirelessData();
}

void startWirelessCommunication()
{
  myRadio.begin(); 
  myRadio.setChannel(115); 
  myRadio.setPALevel(RF24_PA_MAX);
  myRadio.setDataRate( RF24_250KBPS ) ; 
  myRadio.openReadingPipe(0, addresses[0]);
  myRadio.startListening();
  delay(1000);
}

void checkForWirelessData()
{
    if ( myRadio.available()) 
  {
    while (myRadio.available())
    {
    myRadio.read(&data, sizeof(data));
      remoteTemperature = data.temperature;
      remoteTemp = data.temp;
      remoteHumidity = data.humidity;
      remoteHum = data.hum;      

    }
    //Serial.print("\nPackage:");
    //Serial.print("\n");
    Serial.print("O Temp ");
    Serial.print(data.temperature);
    Serial.println("C");
    //Serial.print("O Temp1 ");
    //Serial.print(data.temp);
    //Serial.println("C");
    Serial.print("O Humd ");
    Serial.print(data.humidity);
    Serial.println("%");
    //Serial.print("O Humd1 ");
    //Serial.print(data.hum);
    //Serial.println("%");
       
  } 
void PrintingUI ();
{  
    lcd.setFont(SmallFont);
    lcd.print("OTEMP:",LEFT+1,0);
    lcd.print("OHUM:",LEFT+50,0);
    //lcd.print("ITEMP:",LEFT+1,29);
    //lcd.print("IHUM:",LEFT+50,29);

    lcd.setFont(SmallFont);
    //Printing Temperature
    lcd.print("te.st",LEFT+0,10);
    lcd.print("C",LEFT+33,10);

    //Printing Humidity
    lcd.print((&data.humidity, sizeof(remoteHumidity)),LEFT+45,10);
    lcd.print("%",RIGHT,10);
    delay(1000);

    lcd.update();
}  
}

If I found the right LDC5110_graph library, there are 3 print methods to print different data types. If you want to print an int (or long) data type use the printNumI() method.

void print(char *st, int x, int y);
void printNumI(long num, int x, int y);
void printNumF(double num, byte dec, int x, int y);

Try replacing this line:

lcd.print((&data.humidity, sizeof(remoteHumidity)),LEFT+45,10);

with:

printNumI((data.humidity,LEFT+45,10);

lcd.printNumI(data.humidity,LEFT+55,10); and hey Presto it works.
Busy reading http://www.rinkydinkelectronics.com/resource/UTFT/UTFT.pdf and how this works.
Much appreciated.

Isn't data.humidity a float?

struct package
{
  float temperature;
  float temp;
  float humidity;
  float hum;
}; 
typedef struct package Package;
Package data;

If you don't want to truncate it to an integer you can specify the number of decimal places:

  printNumF(data.humidity, 1, LEFT+55, 10);