Yes, I have took the example and tried to change what I need and came up with the code. But it just shows the "Test" on the screen without me getting 5v to pin 2.
[code#include <SPI.h>
#include <Wire.h>
#include <Adafruit_SSD1306.h>
#define OLED_RESET 4
Adafruit_SSD1306 display(OLED_RESET);
const int pin2 = 2;
int buttonState = 0;
void setup() {
Serial.begin(9600);
display.begin(SSD1306_SWITCHCAPVCC, 0x3C);
display.clearDisplay();
display.display();
delay (1000);
pinMode(pin2, INPUT);
}
void loop() {
buttonState = digitalRead(pin2);
if (digitalRead(pin2) == HIGH)
{
display.setTextSize(2);
display.setTextColor(WHITE);
display.setCursor(0, 0);
display.println("Test");
display.display();
}
}
]