Maker.io main logo

Turn OLED Display on and Off With a Push Button Using Arduino

85

2026-06-17 | By Ron Cutts

License: GNU Lesser General Public License Displays Microcontrollers Switches Arduino

In this tutorial, we are going to turn ON or OFF the OLED display using a button & Arduino.

Watch the video!

What You Will Need

What You Will Need

What You Will Need photo 2

What You Will Need photo 3

What You Will Need photo 4

What You Will Need photo 5

What You Will Need photo 6

What You Will Need photo 7

The Circuit

  • Connect OLED Display pin [SCL] to Arduino pin [SCL]

  • Connect OLED Display pin [SDA] to Arduino pin [SDA]

  • Connect OLED Display pin [VCC] to the breadboard positive pin [5V]

  • Connect OLED Display pin [GND] to the breadboard pin [GND]

  • Connect Arduino Digital pin [4] to the Resistor and button

  • Connect the other side of the resistor to the breadboard pin [GND]

  • Connect the other pin of the button to the breadboard positive pin [5V]

The Circuit

Start Visuino, and Select the Arduino UNO Board Type

Start Visuino as shown in the first picture. Click on the "Tools" button on the Arduino component (Picture 1) in Visuino. When the dialog appears, select "Arduino UNO" as shown in Picture 2

Start Visuino, and Select the Arduino UNO Board Type

Start Visuino, and Select the Arduino UNO Board Type photo 2

In Visuino, Add Components

  • Add "Debounce Button" component

  • Add "Toggle(T) Flip-Flop" component

  • Add "OLED I2C" component

In Visuino Add Components

In Visuino Add Components photo 2

In Visuino Add Components photo 3

In Visuino Set Components

  • Select "DisplayOLED1" and in the properties window select "Power On" and click on the pin icon and select "Boolean SinkPin"

  • Double click on the "DisplayOLED1" and in the "Elements" window, drag "Draw Text" to the left, and in the properties window, set "Text" to ARDUINO and "Size" to 3

  • Close the "Elements" window

  • Select "TFlipFlop1 and in the properties window set "Initial Value" to False

In Visuino Set Components

In Visuino Set Components photo 2

In Visuino Set Components photo 3

In Visuino Set Components photo 4

In Visuino Connect Components

  • Connect Arduino digital pin[4] to "Button1" pin [In]

  • Connect "Button1" pin [Out] to "TFlipFlop1" pin [Clock]

  • Connect "TFlipFlop1" pin [Out] to "DisplayOLED1" pin [Power On]

  • Connect "DisplayOLED1" pin I2C [Out] to Arduino pin I2C [In]

In Visuino Connect Components

Generate, Compile, and Upload the Arduino Code

In Visuino, at the bottom, click on the "Build" tab, make sure the correct port is selected, then click on the "Compile/Build and Upload" button.

Generate, Compile, and Upload the Arduino Code

Play

If you power the Arduino module, the display will show the text; if you press the button, the display will turn on or off.

Congratulations! You have completed your project with Visuino. Also attached is the Visuino project that I created for this tutorial. You can download it and open it in Visuino: https://www.visuino.eu

Downloads

Have questions or comments? Continue the conversation on TechForum, DigiKey's online community and technical resource.