Hello, I am sorry for my English and confusing lay-out of the question, but it is my first time, and I am just going to try. I have searched for other topics with the same question, but there doesn't seem to be another (or I am really blind).
So I have a question about displaying text on an OLED screen with a void in a class. It maybe a confusing explanation of my question, but is it possible?
This is a part of my code, but it doesn't work. How do I make it work?
#include <Wire.h> //library to establish I²C connection
#include <ThreeWire.h> //library to establish I²C communication on every GPOI-pin
#include <Adafruit_GFX.h> //library to print and draw on the OLED-display
#include <Adafruit_SSD1306.h> //library to establish connection with the OLED-display
#include <RtcDS1302.h> //library to convert incoming data from the RTC
#define SCREEN_WIDTH 128 //OLED display width, in pixels
#define SCREEN_HEIGHT 32 //OLED display height, in pixels
#define OLED_RESET -1 //variable to connect the screen with the reset of the arduino (needs to be -1 to share the reset)
#define SCREEN_ADDRESS 0x3C //adress of the OLED-display
#define modes 3 //the amount of modes
class mechanical_switch{
private:
unsigned char _active_mode = 1;
String _name[modes];
public:
String name[modes];
void change_mode(unsigned char mode ){
_active_mode = mode;
display.clearDisplay();
display.setCursor(2, 2);
display.setTextSize(2);
display.print(_name[_active_mode]);
display.display();
delay(2500);
}
};
I am just trying to make it work, so the function change_mode should start if pin 7 is HIGH. The mode should alternate between 1, 2 and 3.
I don't think it is important but I will say it, it is with an Arduino nano ESP32.