#include "U8glib.h" //βιβλιοθήκη OLED οθόνης
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#define OLED_RESET -1
#define SCREEN_ADDRESS 0x3C
#define SCREEN_WIDTH 128
#define SCREEN_HEIGHT 64
int ledPin = 4;
int BuzzerPin = 5;
Adafruit_SSD1306 oled(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
pinMode(ledPin, OUTPUT);
pinMode(BuzzerPin, OUTPUT);
oled.setTextSize(1); // set text size
oled.setTextColor(WHITE); // set text color
oled.setCursor(30, 20); // set position to display
oled.println("Hello World"); // set text
oled.display(); // display on OLED
delay(3000); // wait two seconds for initializing
oled.clearDisplay(); // clear display
}
void loop() {
// put your main code here, to run repeatedly:
tone(BuzzerPin, 1000); // Send 1KHz sound signal...
digitalWrite(ledPin, HIGH);
delay(1000); // ...for 1 sec
digitalWrite(ledPin, LOW);
noTone(BuzzerPin); // Stop sound...
delay(1000); // ...for 1sec
}