I want to change my "bulb" screen for an OLED screen in my car. I have 8 bulbs (showing what door is opened, etc) so 8 inputs on Arduino. When you open door 1 it turns on 2 bulbs, one showing the car and other what door is opened. Now what I need is when the door is opened then the voltage comes to digital input pin 1 and this shows car and one door on the screen. When the door 1 and 2 is opened then it shows a car and 2 doors. I have problem programming this because I cannot find any solution to how an input pin can show something on OLED display. Can someone help me? I want something like this: When ignition is on it will show something like Hello greeting on screen, then it will show what door is opened or if there is an error with ABS or if the handbrake is on. All these are normal 12v inputs which I will make 5v for Arduino.
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();
}
}
]