Created
December 7, 2017 06:31
-
-
Save deladriere/ce9b956744f47b73bd579d335b998461 to your computer and use it in GitHub Desktop.
lexus2K SSD1306 I2C text speed test
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//https://github.com/lexus2k/ssd1306 | |
#include <Wire.h> | |
#include "ssd1306.h" | |
long I2C_clock=2500000; | |
long pot; | |
char buf[10]; | |
unsigned long thisMicros = 0; | |
unsigned long lastMicros = 0; | |
void setup() { | |
ssd1306_128x64_i2c_init(); | |
ssd1306_fillScreen( 0x00 ); | |
Wire.setClock(I2C_clock); | |
} | |
void loop() | |
{ | |
pot=analogRead(5);// pot on A5 to play with the I2C clock | |
I2C_clock=map(pot,1023,0,100L,4000L); | |
I2C_clock=I2C_clock*1000L; | |
Wire.setClock(I2C_clock); | |
thisMicros = micros(); | |
ssd1306_clearScreen(); | |
//ssd1306_fillScreen( 0x00 ); | |
itoa(thisMicros - lastMicros,buf,10); | |
ssd1306_charF12x16(0, 0, buf,STYLE_NORMAL); | |
itoa(I2C_clock,buf,10); | |
ssd1306_charF12x16(0, 2, buf,STYLE_NORMAL); | |
itoa(pot,buf,10); | |
ssd1306_charF12x16(0, 4, buf,STYLE_NORMAL); | |
lastMicros = thisMicros; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment