#include // libraries necessary for running #include #include #include #define SCREEN_WIDTH 128 // wide of screen OLED #define SCREEN_HEIGHT 64 // height OLED #define OLED_RESET -1 // Reset pin (not used in arduino uno) #define SCREEN_ADDRESS 0x3C // Standar I2C direction for OLED // Create an object with oled display Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET); int time = 100; void setup() { Serial.begin(9600); // begin serial // Connections necessary for arduino uno: // SDA -> A4 // SCL -> A5 // VCC -> 5V // GND -> GND // starto OLED diplay if (!display.begin(SSD1306_SWITCHCAPVCC, SCREEN_ADDRESS)) { // Dirección I2C 0x3C Serial.println(F("Error at starting")); for (;;); } display.clearDisplay(); display.setTextSize(2); display.setTextColor(SSD1306_WHITE); for (int n = 9; n <= 13; n++) { // Repeat from 9 to 13 pinMode(n, OUTPUT); // Configure leds as output } } void loop() { static int contador = 0; for (int n = 9; n <= 13; n++) { digitalWrite(n, HIGH); delay(time); digitalWrite(n, LOW); delay(time); } // Mostrar el contador en la pantalla OLED display.clearDisplay(); display.setCursor(10, 25); display.print("Counting: "); display.print(contador); display.display(); contador++; }