Hi,
This is a OLED example code compiling well and runs good before I changed a line: oled.setTextColor(BLUE)
; instead of oled.setTextColor(WHITE);
why?
what color definded in SSD1306?
does it has a background color setting?
Thanks
Adam
/*
* Created by ArduinoGetStarted.com
*
* This example code is in the public domain
*
* Tutorial page: https://arduinogetstarted.com/tutorials/arduino-oled
*/
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#define SCREEN_WIDTH 128 // OLED display width, in pixels
#define SCREEN_HEIGHT 64 // OLED display height, in pixels
// declare an SSD1306 display object connected to I2C
Adafruit_SSD1306 oled(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, -1);
void setup() {
Serial.begin(9600);
// initialize OLED display with address 0x3C for 128x64
if (!oled.begin(SSD1306_SWITCHCAPVCC, 0x3C)) {
Serial.println(F("SSD1306 allocation failed"));
while (true);
}
delay(2000); // wait for initializing
oled.clearDisplay(); // clear display
oled.setTextSize(1); // text size
// oled.setTextColor(WHITE); // text color
oled.setTextColor(BLUE); // text color
oled.setCursor(0, 10); // position to display
oled.println("Hello World!"); // text to display
oled.display(); // show on OLED
}
void loop() {
}
ERROR:
Arduino: 1.8.3 (Windows 7), Board: "Arduino Nano, ATmega328"
C:\Users\HUA.DELLV-PC\Documents\Arduino\sketch_jul30d\sketch_jul30d.ino: In function 'void setup()':
sketch_jul30d:33: error: 'BLUE' was not declared in this scope
oled.setTextColor(BLUE); // text color
^
exit status 1
'BLUE' was not declared in this scope
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.