#include <U8g2lib.h>
#include <Wire.h>
U8G2_SSD1306_128X64_NONAME_F_HW_I2C u8g2(U8G2_R0, U8X8_PIN_NONE);
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
u8g2.begin();
analogReference(DEFAULT);
}
void settings() {
u8g2.setFont(u8g2_font_6x10_tr );
u8g2.setFontRefHeightExtendedText();
u8g2.setDrawColor(1);
u8g2.setFontPosTop();
u8g2.setFontDirection(0);
}
void loop() {
// put your main code here, to run repeatedly:
int messung = analogRead(A0);
double spannung = messung / 204.8;
double strom = -45.411 + 44.5642 * spannung;
Serial.println(strom, 5);
String stromstr = String(strom, 5);
settings();
u8g2.drawStr(10, 10, stromstr.c_str());
u8g2.sendBuffer();
delay(100);
}