Changing a font size

Hi
I am trying to change a font size, so far no luck can you help me please ?

#include "Nokia_5110.h" 

/*
#define RST PA0
#define CE PA1
#define DC PA2
#define DIN PA3
#define CLK PA4
*/
//Nokia_5110 lcd = Nokia_5110(RST, CE, DC, DIN, CLK);
Nokia_5110 lcd = Nokia_5110(PB5, PB6, PB8, PB9, PC15);
//extern unsigned char SmallFont[];
//extern unsigned char TinyFont[];
//extern unsigned char BigNumbers[];
//extern unsigned char mediumNumbers[];

float input_voltage = 0.0;


void setup() {
//   lcd.setFont(SmallFont);
//   lcd.setFont(TinyFont);
  
//  lcd.setFont(BigNumbers);
  //  lcd.setFont(mediumNumbers);
    lcd.clear();

}

void loop() {
    int analog_value = analogRead(PA0);
   
   input_voltage = (analog_value * 5.0) / 1024.0;
   
   if (input_voltage < 0.1) 
   {
     input_voltage=0.0;
   } 
    Serial.print("v = ");
    Serial.println(input_voltage);
    lcd.setCursor(0, 0);
    lcd.print("Voltage= ");
    lcd.print(input_voltage);
    delay(300);
  }

Which 5110 library are you using?

https://www.arduinolibraries.info/libraries/nokia-5110

Did you read this bit in the documentation?

Suggest trying a different library... there are lots around.

Yes I read that, I was using other libraries long time ago, now for some reason the display is blank.

////////////////////////////////////////////// 
//         Arduino Voltmeter Project         //
//            with NOKIA 5110 LCD              //
//            with NOKIA 5110 LCD           //
//           http://www.educ8s.tv           //
/////////////////////////////////////////////


#include <LCD5110_Graph.h> // THE LIBRARY I AM USING IS THIS:  http://www.rinkydinkelectronics.com/library.php?id=47

//************************************************************
//LCD5110 lcd(8,9,10,12,11);// uno
//LCD5110 lcd(PA4, PA3, PA2, PA0, PA1);// stm32f103
LCD5110 lcd(PB5, PB6, PB8, PB9, PC15);  //stm32f103
//***************************************************************

//extern unsigned char BigNumbers[];
//extern unsigned char MediumNumbers[];
//extern unsigned char SmallNumbers[];
extern unsigned char SmallFont[];
extern uint8_t ui[];
extern uint8_t startScreen[];

float voltage = 0.0;
int sensorPin = PA6;
float sensorValue = 0.0f;
String voltageString = "0.0";
int stringLength = 0;

float vout = 0.0;
float vin = 0.0;

void setup() {
  Serial.begin(9600);
  lcd.InitLCD();
  lcd.drawBitmap(0, 0, startScreen, 84, 48);
  lcd.update();
  delay(3000);
  //lcd.setFont(BigNumbers);
   //lcd.setFont(SmallNumbers);
   // lcd.setFont(MediumNumbers);
     lcd.setFont(SmallFont);
  delay(1000);
}

void loop() {
  lcd.clrScr();
  lcd.drawBitmap(0, 0, ui, 84, 48);

  voltage = readVoltage();

  Serial.println(voltage);

  voltageString = String(voltage, 1);

  stringLength = voltageString.length();
  displayVoltage(stringLength);
  lcd.update();
  delay(10);
}
float readVoltage()
{
sensorValue = analogRead(sensorPin);
  vout = (sensorValue * 3.3) / 4095.0;//V
  vin = vout ;
  return vin;
}

void displayVoltage(int length)
{
  switch (length)
  {
   // case 3:  lcd.print(voltageString, 14, 19); break;
   // case 4:  lcd.print(voltageString, 2, 19); break;
    default:  lcd.print(voltageString, 2, 19); break;
  }
}

this program was worked with these pins

//LCD5110 lcd(PA4, PA3, PA2, PA0, PA1);   // stm32f103

WARNING! The two last wires are crossed at LCD5110 lcd(PB5, PB6, PB8, PB9, PC165)

Take a deep look on declarations/connections.

I have no problems with the wires but with font size

Then I suggest you to make a deep analysis of any preexistent font-array for that purpose. That way, you'll realize how font-arrays shows on that particular library and therefore how you should generate those arrays with the proper structure.

Throw me your font-arrays and I'll tell you how it should be generated in order to show chars on the screen properly.

And if your display is blank, check the connections. Then check that those connections are consistent with your programming settings.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.