Trying to convert the code for a different screen and having no luck at all as Im new to this and could really use some help . designing circuits is what i do but not coding
here is the code that I'm trying to conert for the screen I need
from a Liquid crystal to this U8G2_ST7920_128X64_ any help would be great
====================================================
#include <LiquidCrystal.h>
LiquidCrystal lcd(2,3,4,5,6,7);
int ADC_a = 0; //Analog Input
float VIn_a = 0.0; //Voltage In after voltage divider
float Voltage_a = 0.0; //Actual voltage after calculation
float CalVal = 11.1111; //Voltage divider calibration value
//Timing
unsigned long previousMillis = 0;
const long interval = 200; //Interval to read voltages
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
lcd.begin(16,2);
lcd.clear();
lcd.setCursor(0,0);
lcd.print("Volt Meter");
pinMode(A0,INPUT);
pinMode(A1,INPUT);
}
void loop() {
unsigned long currentMillis = millis();
//Timing Loop
if (currentMillis - previousMillis >= interval) {
previousMillis = currentMillis;
ADC_a = analogRead(A0); //Read analog values
VIn_a = (ADC_a * 5.0) / 1024.0; //Convert 10bit input to an actual voltage
Voltage_a = (VIn_a * CalVal);
// float v_rounded = ((int) (Voltage_a * 10.0 + 0.5) / 10.0);
float v_rounded = round(Voltage_a*10)/10;
lcd.setCursor(0,1);
lcd.print(Voltage_a,1);
lcd.setCursor(8,1);
lcd.print(v_rounded);
} //Timing
} //Loop
=========================================================