Hello. I have difficulty with the following, I hope someone can help me.
The string is limited to 9 characters which enter just the width of the oled screen, if I send the data only once it is correct but if I send them two or more times they are accommodated with line break which is how it works. normal but as the data below is fixed it creates a problem for me so I need not to skip the line for any reason. Attached code snippet. I am very new to this.
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
char controlsynth; // this is the string you can't have
String string; // Variable to convert the data to Strig
// and send tol Oled I2C
if (Serial.available() && bank1.getSelection() == 1) {
controlsynth = Serial.read();
string+=controlsynth;
}
if (bank1.getSelection() == 0) {
display.clearDisplay();
display.setTextSize(1);
display.setTextColor(WHITE);
display.setCursor(0, 15);
display.print(string[0]); // this is the string that cannot have a
display.print(string[1]); //newline for any reason
display.print(string[2]);
display.print(string[3]);
display.print(string[4]);
display.print(string[5]);
display.print(string[6]);
display.print(string[7]);
display.print(string[8]);
display.setFont(&FreeMono9pt7b);
display.setTextSize(1);
display.setTextColor(WHITE);
display.setCursor(0, 27);
display.println("BANK 1");
}