Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <Wire.h>
- #include <Adafruit_GFX.h>
- #include <Adafruit_SSD1306.h>
- #define SCRN_WIDTH 128
- #define SCRN_HEIGHT 64
- #define OLED_RESET -1
- uint32_t I2C_clock = 1000000;
- Adafruit_SSD1306 display(SCRN_WIDTH, SCRN_HEIGHT, &Wire, OLED_RESET, I2C_clock, I2C_clock);
- uint32_t thisMicros = 0;
- uint32_t lastMicros = 0;
- void setup() {
- Wire.begin();
- Wire.setClock(I2C_clock);
- display.begin(SSD1306_SWITCHCAPVCC, 0x3C);
- display.display();
- display.clearDisplay();
- display.setTextSize(1);
- display.setTextColor(WHITE);
- }
- void loop()
- {
- thisMicros = micros();
- display.clearDisplay();
- display.setCursor(0,0);
- display.print(thisMicros - lastMicros);
- display.display();
- lastMicros = thisMicros;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement