// pohyblivé pruhy na obrazovce loading...

#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
#define OLED_RESET -1


Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);


void setup() {
  //display.begin(SH1106_SWITCHCAPVCC, 0x3C);  // inicializace OLED displeje
  display.begin(SSD1306_SWITCHCAPVCC, 0x3C);  // initialize with the I2C addr 0x3C (for the 128x64)
  display.clearDisplay();
  display.setTextSize(1);
  display.setTextColor(WHITE);
  Serial.begin(9600); // open the serial port at 9600 bps:  
}


void loop() {
  display.clearDisplay();


int var = map(analogRead(A0), 0, 1023, 1, SCREEN_WIDTH-4); 

display.drawRect (0,0,SCREEN_WIDTH, 6, WHITE);
display.fillRect (2,2, var, 2, WHITE);


display.drawFastHLine (0, 20, SCREEN_WIDTH, WHITE);
display.fillCircle (var, 20, 3, WHITE);

display.drawFastHLine (0, 35, SCREEN_WIDTH, WHITE);
display.drawCircle (var, 35, 3, WHITE);
display.fillCircle (var, 35, 2, BLACK);

display.drawFastHLine (0, 50, SCREEN_WIDTH, WHITE);
display.fillRect (var,48, 2, 5, WHITE);

tone(8,var*5);





      
  display.display();
                                  
                                    
}