OLED DISPLAY color change

Status
Not open for further replies.

ajit_nayak87

Member level 5
Joined
Oct 30, 2017
Messages
86
Helped
1
Reputation
2
Reaction score
1
Trophy points
8
Activity points
981
I have attached my display icon here.


I would like to change the color of Below Text in one color and display paramter in other colors. In below display parameter
MODE: TIME: TimeZone:Relay_Status : Must be in one color Other parameter like AUTO/MANUAL,15:55:55,Timezone1/Timezone2/Timezone3/Timezone4
ON/OFF must be another color.
Code:
MODE:  AUTO/MANUAL
TIME: 15:55:55
TimeZOne: Timezone1/Timezone2/Timezone3/Timezone4
Relay_Status:ON/OFF

My code look like below. I could not able to change color.
display.setTextColor(BLUE); if i use the screen will get blackout.


Code:
#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#define OLED_RESET LED_BUILTIN  //4
Adafruit_SSD1306 display(OLED_RESET);
#define BLUE 0x001F
#define RED 0xF800
#define GREEN 0x07E0
#define CYAN 0x07FF
#define YELLOW 0xFFE0

void setup()
{
  Serial.begin(115200);
  display.begin(SSD1306_SWITCHCAPVCC, 0x3C);
  display.clearDisplay();
  display.display();
  display.setTextSize(1);
  display.setTextColor(WHITE);
  display.setCursor(0, 0);
// timer.setInterval(1000, Display);
}

void loop()
{
Display();
}

void Display()
{
  Chk_manual_Auto_Status();
  display.setCursor(0, 0);
  //display.clearDisplay();
  display.print("MODE:");
  if (manual == 0)
  {
    //display.setTextColor(WHITE);
    display.clearDisplay();
    display.println("AUTO");
    display.display();
    //display.setTextColor(BLUE);
  } else
  {
    //display.setTextColor(WHITE);
    display.clearDisplay();
    display.println("MANUAL");
    display.display();
   // display.setTextColor(BLUE);
  }

  display.print("TIME:");
  //display.clearDisplay();
  display.println(currentTime);

  display.display();
  //display.setTextColor(WHITE);
  display.print("TIME_ZONE:");
  display.println(TimeZone_Status);
  display.display();
  display.print("RELAY STATUS:");
  if (Relay_Status == 1)
  {
    display.println("ON");
    display.display();
  } else
  {
    display.println("OFF");
    display.display();
  }
  delay(2000);

}

arduino-uno arduino-esp8266 ad
 

hello,

i think this Oled display can only use Yellow color for 1rst line and other lines in blue color ...
**broken link removed**...
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…