Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
arduinoled-test
#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#define OLED_RESET 4
Adafruit_SSD1306 display(OLED_RESET);
unsigned long frame = 0;
const float pi = 3.14;
const float speed = 10;
void setup() {
Serial.begin(9600);
display.begin(SSD1306_SWITCHCAPVCC, 0x3C);
}
void loop() {
display.clearDisplay();
for (int x = 0; x < 128; x ++) {
int y = (int) ((sin((x + frame) / pi) + 1) * 4) + 12;
display.drawPixel(x, y, WHITE);
}
display.display();
frame += speed;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.