Potentiometer voltage on an OLED display with Arduino
3 parts
An SSD1306 OLED display on an Uno R3's I2C pins: the simulation shows a potentiometer's voltage on it, as text and as a bar. Turn the knob and watch the bar follow it. At the knob's middle the display reads 2.50 V and the bar is 61 pixels long. The sketch draws each picture into a 1,024-byte copy of the display in the board's RAM, then sends the whole of it over I2C, about 22 times a second. The probe on the display's supply shows its draw rise with the lit pixels: 2.0 mA dark, 5.7 mA at the middle. The sketch clears the display before its first picture, so the Adafruit library's logo never shows.
- U1 Uno R3, uno_oled_pot.ino.hex
- U2 OLED 128x64 I2C
- POT1 Pot, 10kΩ·50%