#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#define int radious = 10
const uint8_t buttonPins[] = {0};
#define SCREEN_WIDTH 128 // OLED display width, in pixels
#define SCREEN_HEIGHT 64 // OLED display height, in pixels
#define OLED_RESET -1 // Reset pin # (or -1 if sharing Arduino reset pin)
#define SCREEN_ADDRESS 0x3C ///< See datasheet for Address; 0x3D for 128x64, 0x3C for 128x32
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
if (!display.begin(SSD1306_SWITCHCAPVCC, SCREEN_ADDRESS)) {
Serial.println(F("SSD1306 allocation failed"));
for (;;); // Don't proceed, loop forever
}
display.clearDisplay();
display.setTextSize(1);
display.setTextColor(SSD1306_WHITE);
display.println("Iniciando pantalla...");
pinMode(buttonPins[0], INPUT_PULLUP);
}
/*void drawpoint()
{
display.clearDisplay();
for (int x = 0; x < SCREEN_WIDTH; x++) {
for (int y = 0; y < SCREEN_HEIGHT; y++) {
// Limpiar buffer
display.clearDisplay();
// Dibujar un píxel
display.drawPixel(x, y, SSD1306_WHITE);
// Enviar a pantalla
display.display();
}
}
}*/
/*void drawCoordinate(int x, int y)
{
// Limpiar buffer
display.clearDisplay();
// Dibujar un píxel
display.drawPixel(x, y, SSD1306_WHITE);
// Enviar a pantalla
display.display();
}*/
void drawCircle(int x, int y, int r)
{
display.clearDisplay();
//display.drawCircle(x, y, r, SSD1306_WHITE);
display.fillCircle(x, y, r, SSD1306_WHITE);
//display.fillCircle(x, y, r, SSD1306_WHITE);
display.display();
}
byte readButton() {
while (true) {
/*for (byte i = 0; i < 4; i++) {
byte buttonPin = buttonPins[];
if (digitalRead(buttonPin) == LOW) {
return i;
}
}*/
byte buttonPin = buttonPins[0];
if (digitalRead(buttonPin) == LOW){
return 0;
}
delay(1);
}
}
void loop() {
// put your main code here, to run repeatedly:
drawCircle(40, 40, 10);
delay(500); // this speeds up the simulation
}