#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
// OLED setup
#define SCREEN_WIDTH 128
#define SCREEN_HEIGHT 64
#define OLED_RESET -1
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);
void setup() {
Serial.begin(9600);
if (!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) { // 0x3C is the usual address
Serial.println(F("SSD1306 allocation failed"));
for (;;);
}
display.clearDisplay();
display.setTextSize(1);
display.setTextColor(SSD1306_WHITE);
// Display initial text
display.setCursor(0, 0);
display.println("OLED Test Ready!");
display.display();
delay(2000);
}
void loop() {
static int barWidth = 0;
static bool increasing = true;
display.clearDisplay();
// Text
display.setCursor(0, 0);
display.println("OLED Test");
// Draw rectangle outline
display.drawRect(4, 20, 120, 12, SSD1306_WHITE);
// Fill rectangle as bar
display.fillRect(4, 20, barWidth, 12, SSD1306_WHITE);
display.display();
// Update bar for animation
if (increasing) {
barWidth += 2;
if (barWidth >= 120) increasing = false;
} else {
barWidth -= 2;
if (barWidth <= 0) increasing = true;
}
delay(50);
}
top of page
Welcome to AmoTech Electronics
-
Empowering Innovation through SMART Electronics Solutions!
-
Our One-Stop Hub for IoT, Embedded Systems, Machine Learning, and Artificial Intelligence.
-
Shaping the future with Intelligent Technology and next-gen Automation.



Store Location
Address: Kigali, Rwanda
BRGD PLAZA KK15 Rd Opposite of RP Kigali
Email: amotechelectronics1@gmail.com
Tel: 0796594130
Shop
© 2025 All rights reserved
Customer Support
SKU: DIS547
R₣7,000Price
No Reviews YetShare your thoughts.
Be the first to leave a review.
You might also like
bottom of page


















