/**************************************************************************
This is an example for our Monochrome OLEDs based on SSD1306 drivers
Pick one up today in the adafruit shop!
------> http://www.adafruit.com/category/63_98
This example is for a 128x64 pixel display using I2C to communicate
3 pins are required to interface (two I2C and one reset).
Adafruit invests time and resources providing this open
source code, please support Adafruit and open-source
hardware by purchasing products from Adafruit!
Written by Limor Fried/Ladyada for Adafruit Industries,
with contributions from the open source community.
BSD license, check license.txt for more information
All text above, and the splash screen below must be
included in any redistribution.
**************************************************************************/
#define Buton 8
#define Btn 4
#include <SPI.h>
#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
// Declaration for an SSD1306 display connected to I2C (SDA, SCL pins)
#define OLED_RESET 4 // Reset pin # (or -1 if sharing Arduino reset pin)
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);
#define NUMFLAKES 10 // Number of snowflakes in the animation example
#define LOGO_HEIGHT 16
#define LOGO_WIDTH 16
//static const unsigned char PROGMEM logo_bmp ="hoşgeldiniz";
// static const unsigned char PROGMEM logo_bmp[] =
// { B00000000, B11000000,
// B00000001, B11000000,
// B00000001, B11000000,
// B00000011, B11100000,
// B11110011, B11100000,
// B11111110, B11111000,
// B01111110, B11111111,
// B00110011, B10011111,
// B00011111, B11111100,
// B00001101, B01110000,
// B00011011, B10100000,
// B00111111, B11100000,
// B00111111, B11110000,
// B01111100, B11110000,
// B01110000, B01110000,
// B00000000, B00110000 };
void setup() {
Serial.begin(9600);
// by default, we'll generate the high voltage from the 3.3v line internally! (neat!)
if (!display.begin(SSD1306_SWITCHCAPVCC, 0x3D)) { // Address 0x3D for 128x64
Serial.println(F("SSD1306 allocation failed"));
for (;;); // Don't proceed, loop forever
} // initialize with the I2C addr 0x3C (for the 128x32)
// Clear the buffer.
pinMode(Buton, INPUT);
pinMode(Btn, INPUT);
}
bool butonOlusum = false;
bool anaEkrandanCikildiMi = false;
void loop() {
girisEkrani();
// if (digitalRead(Buton) == 1)
// denemeFonksiyon();
// else
// printf("deneme");
}
// /*
// * robojaxText(String text, int x, int y,int size, boolean d)
// * text is the text string to be printed
// * x is the integer x position of text
// * y is the integer y position of text
// * z is the text size, 1, 2, 3 etc
// * d is either "true" or "false". Not sure, use true
// */
// void robojaxText(String text, int x, int y,int size, boolean d) {
// display.setTextSize(size);
// display.setTextColor(WHITE);
// display.setCursor(x,y);
// display.println(text);
// if(d){
// display.display();
// }
// //delay(100);
// }
void girisEkrani() {
display.clearDisplay();
display.drawRect(15, 10, 100, 20, WHITE);
display.drawRect(15, 35, 100, 20, WHITE );
display.setTextSize(1);
int butonDurum = digitalRead(Buton);
if (butonDurum==1) {
butonOlusum = !butonOlusum;
if (anaEkrandanCikildiMi == false) {
if (butonOlusum) {
display.setTextColor( BLACK, WHITE);
display.setCursor(35, 40);
display.println("Zorluk Sec");
display.setTextColor(WHITE, BLACK);
display.setCursor(37, 15);
display.println("Giris Yap");
display.display();
if (false) {
girisYapSecildi();
anaEkrandanCikildiMi = true;
}
}
}
} else {
if (anaEkrandanCikildiMi == false) {
display.setTextColor(WHITE, BLACK);
display.setCursor(35, 40);
display.println("Zorluk Sec");
display.setTextColor(BLACK, WHITE);
display.setCursor(37, 15);
display.println("Giris Yap");
display.display();
if (false) {
zorlukSecSecildi();
anaEkrandanCikildiMi = true;
}
}
}
}
// display.setTextColor(WHITE);
// display.setCursor(37, 15);
// display.println("Giris Yap");
// display.setCursor(35, 40);
// display.println("Zorluk Sec");
//display.drawCircle(63,31, 31, WHITE);
//display.startscrollright(0x00, 0x0F);
void girisYapSecildi() {
}
void zorlukSecSecildi() {
display.clearDisplay();
display.setTextColor(WHITE, BLACK);
display.setCursor(35, 40);
display.println("Zorluk Sec Seçimi Yapıldı");
}
void denemeFonksiyon() {
int i;
int xEksen = 15;
int yEksen = 15;
int xBoyut = 30;
int yBoyut = 30;
for (i = 1; i < 15; ++i)
{
xEksen += 4;
yEksen += 5;
xBoyut += 3;
yBoyut += 3;
display.clearDisplay();
// robojaxText("Voltage: ", 4, 3, 1, false);
// robojaxText("3", 72, 3, 1, false);
// robojaxText("V", 110, 3, 1, false);
// robojaxText("Temprature: 32C", 4, 11, 1, false);
// robojaxText("Capacity: 92.86L", 4, 21, 1, false);
// display.drawLine(35, 35, 50,50, WHITE);
delay(100);
display.drawRect(xEksen, yEksen, xBoyut, yBoyut, WHITE);
//display.drawCircle(63,31, 31, WHITE);
//display.startscrollright(0x00, 0x0F);
display.display();
}
}