#include <Adafruit_SSD1306.h>
#include <Wire.h>
long f_new = 8800;
long interfreq = 455;
int stp = 5;
Adafruit_SSD1306 oled(128, 64, &Wire);
void setup()
{
oled.begin(SSD1306_SWITCHCAPVCC, 0x3C);
oled.clearDisplay();
displayLayout();
}
void loop()
{
oled.setTextColor(WHITE);
oled.setTextSize(2);
oled.setCursor(40, 3);
oled.print(f_new);
oled.display();
}
void displayLayout()
{
oled.setTextColor(WHITE);
oled.drawLine(0, 20, 127, 20, WHITE);
oled.drawLine(0, 43, 127, 43, WHITE);
oled.drawLine(105, 24, 105, 39, WHITE);
oled.setTextSize(2);
oled.setCursor(2, 25);
oled.print("TS:");
oled.display();
if (stp == 2) oled.print("1Hz");
if (stp == 3) oled.print("10Hz");
if (stp == 4) oled.print("1k");
if (stp == 5) oled.print("5k");
if (stp == 6) oled.print("10k");
if (stp == 1) oled.print("1M");
oled.setCursor(2, 48);
oled.print("IF:");
oled.print(interfreq);
oled.print("k");
oled.setTextSize(1);
oled.setCursor(110, 23);
if (f_new < 1000000) oled.print("kHz");
if (f_new >= 1000000) oled.print("MHz");
oled.setCursor(110, 33);
if (interfreq == 0) oled.print("VFO");
if (interfreq != 0) oled.print("LO");
oled.display();
}