Nokia display (newbie)


Hello,

I have wireup 2 ds18b20 sensors and made a thermometer

My serial monitor works just fine.
My Nokia screen displays the correct temperatures
BUT

The display resets itself every time a new measurement is acquired.
I have tried all the possible combinations that i can think off in regards the placement of .clearDisplay ,
.begin part of the code.

Please some help so as to make the display NOT blink on and off on each measurement…?

/*-----( Import needed libraries )-----*/

#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>      //for graphics
#include <Adafruit_PCD8544.h>  //for Nokia 5110 lcd 
#include <Wire.h>
#include <DallasTemperature.h>


/*-----( Declare Constants and Pin Numbers )-----*/
#define ONE_WIRE_BUS_PIN 2

float Dimitris;
float Thanos;

//Init Display (SCLK, DIN, D/C, CS, RST)
Adafruit_PCD8544 display = Adafruit_PCD8544(7, 6, 5, 4, 3);

/*-----( Declare objects )-----*/
// Setup a oneWire instance to communicate with any OneWire devices
OneWire oneWire(ONE_WIRE_BUS_PIN);

// Pass our oneWire reference to Dallas Temperature.
DallasTemperature sensors(&oneWire);

/*-----( Declare Variables )-----*/
// Assign the addresses of your 1-Wire temp sensors.
// See the tutorial on how to obtain these addresses:
// http://www.hacktronics.com/Tutorials/arduino-1-wire-address-finder.html

DeviceAddress Probe01 = { 0x28, 0xFF, 0x0F, 0x54, 0xA2, 0x17, 0x05, 0xF5 }; 
DeviceAddress Probe02 = { 0x28, 0xFF, 0xF3, 0x49, 0xA2, 0x17, 0x05, 0xD7 };


void setup()   /****** SETUP: RUNS ONCE ******/
{

  // start serial port to show results
  Serial.begin(115200);
  Serial.print("File:_2probes");
  //Serial.println(DALLASTEMPLIBVERSION);
  
  // Initialize the Temperature measurement library
  sensors.begin();
  
  // set the resolution to 10 bit (Can be 9 to 12 bits .. lower is faster)
  sensors.setResolution(Probe01, 9);
  sensors.setResolution(Probe02, 9);
  
  
  display.begin();
  display.clearDisplay();   // clears the screen and buffer
  display.setContrast(60);
}//--(end setup )---

void loop() {
  
  
  
  Serial.println();
  Serial.print("Number of Devices found on bus = ");  
  Serial.println(sensors.getDeviceCount());  
  Serial.print("Getting temperatures... ");  
  Serial.println();   
    // Command all devices on bus to read temperature  
  sensors.requestTemperatures();  
  Serial.print("Probe 01:   ");
  printTemperature(Probe01);
  Serial.println();
  Serial.print("Probe 02:   ");
  printTemperature(Probe02);
  Serial.println();
  delay(5000);

  
  sensors.requestTemperatures();
  Thanos = (sensors.getTempCByIndex(0));
  Dimitris = (sensors.getTempCByIndex(1));
  
  display.begin();
  display.setContrast(60);
  display.clearDisplay();   // clears the screen and buffer
  
  display.setCursor(0,0);
  display.setTextSize(1);
  display.println(" Current Temp ");
  display.print(Dimitris);
  display.println();
  display.print(Thanos);

  //delay(150);
  
   
  }//--(end main loop )---

/*-----( Declare User-written Functions )-----*/
void printTemperature(DeviceAddress deviceAddress)
{

float tempC = sensors.getTempC(deviceAddress);

   if (tempC == -127.00) 
   {
   Serial.print("Error getting temperature  ");
    display.clearDisplay();
    display.print("Check Probes");
   } 
   else
   {
   Serial.print("C: ");
   Serial.print(tempC);
   //Serial.print(" F: ");
   //Serial.print(DallasTemperature::toFahrenheit(tempC));
   }
}// End printTemperature
//*********( THE END )***********
  Dimitris = (sensors.getTempCByIndex(1));
  
  display.begin();

What happens when you lose the display.begin?

If i omit the display.begin the screen stops on the adafruit logo.
The date continue to appear on the serial monitor.

You appear to be trying to use two display libraries at once, and expecting text outcome with graphic library commands. I think Tolpuddle's comment was legitimate, that command should be redundant.

You might try deleteing all reference to the GFX, and using the lcd.print commands as shown in the HelloWorld example with the PDC8544 library.

I think there is a swag of redundant junk in your temperature code too, but you might sort out the LCD first.

If you are actually trying to mix text and graphics, I think you are still on the wrong tram. There are better displays than the 5110 for that, but I think you might get a result which may be worth the intellectual exercise by ditching both libraries, and using the RinkyDink/Henning Karlsen 5110 library.

Thank you,
I will try this advice during the weekend.

I know the code is a mess but i am just getting started with arduino. Will try to short it out as soon as i fix the blinking issue.

Will get back to you with the results of your suggestion.

Lose the display clear too - overprint the previous data with spaces.