        <style>
            #donation_buttons td{
                border:medium none;
                background: inherit !important;
            }
            #donation_buttons table{               
                border:medium none;
                margin: auto;
                width: auto;
            }
        </style>
        {"id":6095,"date":"2020-12-17T00:41:57","date_gmt":"2020-12-17T00:41:57","guid":{"rendered":"http:\/\/rogerbit.com\/wprb\/?p=6095"},"modified":"2020-12-17T00:41:57","modified_gmt":"2020-12-17T00:41:57","slug":"turn-on-220v-light-with-arduino-and-oled-i2c-ssd1306-display","status":"publish","type":"post","link":"https:\/\/rogerbit.com\/wprb\/2020\/12\/turn-on-220v-light-with-arduino-and-oled-i2c-ssd1306-display\/","title":{"rendered":"Turn on 220V light with Arduino and oled I2C SSD1306 display"},"content":{"rendered":"<p><iframe loading=\"lazy\" width=\"1160\" height=\"653\" src=\"https:\/\/www.youtube.com\/embed\/YZ26CqN3zDg?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen><\/iframe><\/p>\n<p>In this tutorial we will review the I2C OLED display module of 0.91 inches with the SSD1306 OLED driver of the company MakerFocus With it we will develop a small project with Arduino mino pro, a relay module, a pushbutton, the ignition of a focus.<\/p>\n<p><strong>Description:<\/strong><\/p>\n<p>MakerFocus 2-Piece I2C 0.91-inch OLED Display Module with SSD1306 Driver<\/p>\n<p><a href=\"http:\/\/rogerbit.com\/wprb\/wp-content\/uploads\/2020\/09\/19e4b5bf-b35a-476c-af5d-e0c96ff111da.jpg\"><img loading=\"lazy\" class=\"alignnone wp-image-5870\" src=\"http:\/\/rogerbit.com\/wprb\/wp-content\/uploads\/2020\/09\/19e4b5bf-b35a-476c-af5d-e0c96ff111da.jpg\" sizes=\"(max-width: 524px) 100vw, 524px\" srcset=\"http:\/\/rogerbit.com\/wprb\/wp-content\/uploads\/2020\/09\/19e4b5bf-b35a-476c-af5d-e0c96ff111da.jpg 800w, http:\/\/rogerbit.com\/wprb\/wp-content\/uploads\/2020\/09\/19e4b5bf-b35a-476c-af5d-e0c96ff111da-150x150.jpg 150w, http:\/\/rogerbit.com\/wprb\/wp-content\/uploads\/2020\/09\/19e4b5bf-b35a-476c-af5d-e0c96ff111da-300x300.jpg 300w, http:\/\/rogerbit.com\/wprb\/wp-content\/uploads\/2020\/09\/19e4b5bf-b35a-476c-af5d-e0c96ff111da-768x768.jpg 768w, http:\/\/rogerbit.com\/wprb\/wp-content\/uploads\/2020\/09\/19e4b5bf-b35a-476c-af5d-e0c96ff111da-600x600.jpg 600w\" alt=\"\" width=\"524\" height=\"524\" \/><\/a><\/p>\n<p>You can purchase these displays, at a low price on the\u00a0<a href=\"https:\/\/www.makerfocus.com\/?aff=31\">MakerFocus page<\/a><\/p>\n<p><a href=\"https:\/\/www.makerfocus.com\/?aff=31\"><img loading=\"lazy\" class=\"alignnone size-full wp-image-5875\" src=\"http:\/\/rogerbit.com\/wprb\/wp-content\/uploads\/2020\/09\/logo.png\" sizes=\"(max-width: 400px) 100vw, 400px\" srcset=\"http:\/\/rogerbit.com\/wprb\/wp-content\/uploads\/2020\/09\/logo.png 400w, http:\/\/rogerbit.com\/wprb\/wp-content\/uploads\/2020\/09\/logo-300x69.png 300w\" alt=\"\" width=\"400\" height=\"92\" \/><\/a><\/p>\n<p><a href=\"https:\/\/www.makerfocus.com\/collections\/display\/products\/2pcs-i2c-oled-display-module-0-91-inch-i2c-ssd1306-oled-display-module-1?aff=31\">MakerFocus 2Pcs I2C OLED Display Module 0.91 Inch I2C SSD1306 OLED Display Module<\/a><\/p>\n<p>DISPLAY module OLED display, no backlighting, self-maintenance.<br \/>\nThe performance of the display is better than the traditional LCD screen, also a lower consumption.<br \/>\nSpecifications:<\/p>\n<p>Controller<\/p>\n<p>IC: SSD1306 Size: 0.91 inch OLED Resolution: 128 x 32<\/p>\n<p>Size: 38*12mm Number of pins: 4-pin<\/p>\n<p>Interface Type: IIC<\/p>\n<p>interface Color Display: White\/Blue<\/p>\n<p>Pin Description:<\/p>\n<p>GND: Power Ground<\/p>\n<p>VCC: Power+ (DC 3.3 x 5v)<\/p>\n<p>Operating Temperature: -40x85oC<\/p>\n<p>SCL: SDA Clock Line: Data Line<\/p>\n<p>OLED display, no backlighting, self-lighting, Display color: blue.<br \/>\nThe display performance is better than the traditional LCD screen, also lower consumption; IIC (I2C communications) simplifies connections.<br \/>\nUse with Arduino, ESP8266, ESP32, STM32, etc. 3.3 to 5v voltage<\/p>\n<hr \/>\n<p>You may be interested in projects in Arduino, pic, robotics, telecommunications,\u00a0<a href=\"http:\/\/www.youtube.com\/user\/carlosvolt?sub_confirmation=1\">subscribe http:\/\/www.youtube.com\/user\/carlosvolt?sub_confirmation=1<\/a>\u00a0videos with full source code and diagrams<\/p>\n<div id=\"ubm-banners-rotation-n1\" data-interval=\"4000\" class=\"ubm_banners_rotation\" style=\"overflow: hidden; width: 200px; height: 150px;\"><div id=\"3_ubm_banner\" class=\"ubm_rotating_banner\"><a href=\"https:\/\/bit.ly\/3aXRDAu\" target=\"_blank\" rel=\"dofollow\"><img src=\"https:\/\/rogerbit.com\/wprb\/wp-content\/uploads\/useful_banner_manager_banners\/3-2-logo youtube.png\" width=\"100%\" height=\"100%\" alt=\"SUSCRIBETE A NUESTRO CANAL DE YOUTUBE, TUTORIALES GRATIS\" \/><\/a><\/div><\/div>\n<hr \/>\n<p><strong>Circuit<\/strong><\/p>\n<p><a href=\"http:\/\/rogerbit.com\/wprb\/wp-content\/uploads\/2020\/09\/display_oled_128_32_arduino_luz.jpg\"><img loading=\"lazy\" class=\"alignnone size-large wp-image-5868\" src=\"http:\/\/rogerbit.com\/wprb\/wp-content\/uploads\/2020\/09\/display_oled_128_32_arduino_luz-975x1024.jpg\" sizes=\"(max-width: 975px) 100vw, 975px\" srcset=\"http:\/\/rogerbit.com\/wprb\/wp-content\/uploads\/2020\/09\/display_oled_128_32_arduino_luz-975x1024.jpg 975w, http:\/\/rogerbit.com\/wprb\/wp-content\/uploads\/2020\/09\/display_oled_128_32_arduino_luz-286x300.jpg 286w, http:\/\/rogerbit.com\/wprb\/wp-content\/uploads\/2020\/09\/display_oled_128_32_arduino_luz-768x807.jpg 768w, http:\/\/rogerbit.com\/wprb\/wp-content\/uploads\/2020\/09\/display_oled_128_32_arduino_luz-600x630.jpg 600w, http:\/\/rogerbit.com\/wprb\/wp-content\/uploads\/2020\/09\/display_oled_128_32_arduino_luz-820x861.jpg 820w, http:\/\/rogerbit.com\/wprb\/wp-content\/uploads\/2020\/09\/display_oled_128_32_arduino_luz-1320x1386.jpg 1320w\" alt=\"\" width=\"975\" height=\"1024\" \/><\/a><\/p>\n<p><strong>Project source code<\/strong><\/p>\n<p>Remember to install the U8g2lib library, the steps to do it, are the video above.<\/p>\n<pre class=\"lang:arduino decode:true \" title=\"Source Code\">\/\/ Canal de youtube http:\/\/www.youtube.com\/user\/carlosvolt?sub_confirmation=1\r\n\/\/Tik-Tok https:\/\/www.tiktok.com\/@carlosvolt\r\n\/\/https:\/\/www.instagram.com\/carlosvolt_electronic_robotic\r\n#include &lt;Arduino.h&gt;\r\n#include &lt;U8g2lib.h&gt;\r\n#ifdef U8X8_HAVE_HW_SPI\r\n#include &lt;SPI.h&gt;\r\n#endif\r\n#ifdef U8X8_HAVE_HW_I2C\r\n#include &lt;Wire.h&gt;\r\n#endif\r\nint ledPin = 10;\/\/Pin para el led o luz\r\nint botonPin = 2; \/\/Pin para el pulsador\r\nint estadoBoton = 0;\r\nint estado = 0;\r\nU8G2_SSD1306_128X32_UNIVISION_1_SW_I2C u8g2(U8G2_R0, \/* clock=*\/ SCL, \/* data=*\/ SDA, \/* reset=*\/ U8X8_PIN_NONE);   \/\/ Adafruit Feather ESP8266\/32u4 Boards + FeatherWing OLED\r\nvoid setup(void) {\r\n  u8g2.begin();\/\/Inicializamos el display\r\n  \/\/ initialize the LED pin as an output:\r\n  pinMode(ledPin, OUTPUT);\/\/ Inicializamos el pin 10 como salida(led)\r\n  pinMode(botonPin, INPUT_PULLUP);\/\/Inicializamos el pin 2 como entrada(bot\u00f3n)\r\n  displayOled();\/\/Lamado de la funci\u00f3n, para arrancar el display con la leyanda \"Luz: Off\"\r\n}\r\nvoid loop(void) {\r\n  estadoBoton = digitalRead(botonPin);\/\/Leemos el pulsador para ver su estado\r\n  \/\/Enciende o apaga la luz \r\nif (estadoBoton == LOW) {\/\/Si el pulsador est\u00e1 precionado se cumple esta condici\u00f3n\r\nestadoBoton = digitalRead(botonPin);\/\/Leemos el estado del bot\u00f3n nuevamente\r\nif(estado ==0){\/\/Si la variable estado es igual a 0 se cumple esta condici\u00f3n\r\ndigitalWrite(ledPin, HIGH);\/\/ Encendemos el led\r\nestado = 1;\/\/Asignamos el valor 1 a la variable \"estado\"\r\ndisplayOled();\r\n} else{\r\n digitalWrite(ledPin, LOW);\/\/Enviamos esta cadena para apagar la luz\r\n estado = 0;\r\n displayOled();\r\n  }\r\nwhile(estadoBoton == LOW){\r\nestadoBoton = digitalRead(2);\/\/Se cumple esta condici\u00f3n mientras est\u00e9 precionado el bot\u00f3n   \r\n  }\r\n }\r\n} \r\n\/\/Visializar en el display el estado de la luz\r\n void displayOled(){\r\n  u8g2.firstPage();\r\n  do {\r\n    u8g2.setFont(u8g2_font_ncenB10_tr);\r\n    if(estado == 1){\r\n    u8g2.drawStr(0,24,\"Luz: ON\");\r\n    }\r\n     if(estado == 0){\r\n    u8g2.drawStr(0,24,\"Luz: Off\");\r\n    }\r\n    } while ( u8g2.nextPage() );\r\n}<\/pre>\n<p>\u2b50\ufe0f<span>\u00a0SUBSCRIBE: <a href=\"https:\/\/www.youtube.com\/user\/carlosvolt?sub_confirmation=1\">https:\/\/www.youtube.com\/user\/carlosvolt?sub_confirmation=1<\/a>\u00a0(Don&#8217;t\u00a0forget to activate the\u00a0<\/span>\ud83d\udd14)<\/p>\n<p>\ud83d\udc49<span>Secondary channel:\u00a0<a href=\"https:\/\/www.youtube.com\/channel\/UCjES9aB4g1F3IQbAk2nWCZg\">https:\/\/www.youtube.com\/channel\/UCjES9aB4g1F3IQbAk2nWCZg<\/a><\/span><\/p>\n<p>\ud83d\udc49<span>Instagram:\u00a0<a href=\"https:\/\/www.instagram.com\/carlosvolt_electronic_robotic\/\">https:\/\/www.instagram.com\/carlosvolt_tutoriales\/<\/a><\/span><\/p>\n<p>\ud83d\udc49<span>Tik Tok:\u00a0<a href=\"https:\/\/www.tiktok.com\/@carlosvolt\">https:\/\/www.tiktok.com\/@carlosvolt<\/a><\/span><\/p>\n<p>\ud83d\udc49<span>Fanpage:\u00a0<a href=\"https:\/\/www.facebook.com\/rogerbitfanpage\/\">https:\/\/www.facebook.com\/rogerbitfanpage\/<\/a><\/span><\/p>\n<p>\ud83d\udc49<span>Facebook:\u00a0<a href=\"https:\/\/www.facebook.com\/groups\/RogerBit\">https:\/\/www.facebook.com\/groups\/RogerBit<\/a><\/span><\/p>\n<p>\ud83d\udc49<span>Twitter:\u00a0<a href=\"https:\/\/twitter.com\/rogerbit_\">https:\/\/twitter.com\/rogerbit_<\/a><\/span><\/p>\n<p>\ud83d\udc49<span>Donations by paypal\u00a0<a href=\"https:\/\/goo.gl\/824Dnm\">https:\/\/goo.gl\/824Dnm<\/a>\u00a0or\u00a0<a href=\"mailto:donacion@rogerbit.com\">donacion@rogerbit.com<\/a><\/span><\/p>\n<p>\ud83d\udc49<span>Website:\u00a0<a href=\"https:\/\/www.rogerbit.com\/\">https:\/\/www.rogerbit.com<\/a><\/span><\/p>\n<hr \/>\n<p>SUBSCRIBE TO OUR NEWSLETTERS, RECEIVE IN YOUR EMAIL THE MOST OUTSTANDING NEWS, JUST BY ENTERING YOUR EMAIL<\/p>\n<p style=\"text-align: left;\">[wysija_form id=&#8221;1&#8243;]<\/p>\n<hr \/>\n<p style=\"text-align: left;\"><div class=\"page-sidebar widget\" id=\"donation_buttons\"><form action=\"https:\/\/www.paypal.com\/cgi-bin\/webscr\" method=\"post\" target=\"_blank\" ><input type=\"hidden\" name=\"business\" value=\"donacion@rogerbit.com\"><input type=\"hidden\" name=\"bn\" value=\"mbjtechnolabs_SP\"><input type=\"hidden\" name=\"cmd\" value=\"_donations\"><input type=\"hidden\" name=\"item_name\" value=\"Ayuda a RogerBit.com\"><input type=\"hidden\" name=\"item_number\" value=\"www.rogerbit.com\"><input type=\"hidden\" class=\"set_donation_button_amount\" name=\"amount\" value=\"1\"><table ><tbody><tr><td><label for=\"rogerBit necesita de tu ayuda para seguir existiendo :-)\">rogerBit necesita de tu ayuda para seguir existiendo :-)<\/label><\/td><\/tr><\/tbody><\/table><table ><tbody><tr><td><input style=\"margin-top:10px;\" type=\"image\" name=\"submit\" border=\"0\" src=\"https:\/\/www.paypal.com\/en_US\/i\/btn\/btn_donateCC_LG.gif\" alt=\"PayPal - The safer, easier way to pay online\"><\/td><\/tr><\/tbody><\/table><input type=\"hidden\" name=\"currency_code\" value=\"USD\"><input type=\"hidden\" name=\"notify_url\" value=\"https:\/\/rogerbit.com\/wprb\/?Donation_Button&#038;action=ipn_handler\"><\/form><\/div><\/p>\n<hr \/>\n<p><strong>RECOMMENDED PROJECT<\/strong><\/p>\n<p><iframe loading=\"lazy\" width=\"1160\" height=\"653\" src=\"https:\/\/www.youtube.com\/embed\/fFRVkqUUVm4?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen><\/iframe><\/p>\n<!-- AddThis Advanced Settings generic via filter on the_content --><!-- AddThis Share Buttons generic via filter on the_content -->","protected":false},"excerpt":{"rendered":"<p>In this tutorial we will review the I2C OLED display module of 0.91 inches with the SSD1306 OLED driver of the company MakerFocus With it we will develop a small project with Arduino mino pro, a relay module, a pushbutton, the ignition of a focus. Description: MakerFocus 2-Piece I2C 0.91-inch OLED Display Module with SSD1306 [&hellip;]<!-- AddThis Advanced Settings generic via filter on get_the_excerpt --><!-- AddThis Share Buttons generic via filter on get_the_excerpt --><\/p>\n","protected":false},"author":1,"featured_media":6096,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[648],"tags":[45,950,1035,911,908,909,1031,986,910],"_links":{"self":[{"href":"https:\/\/rogerbit.com\/wprb\/wp-json\/wp\/v2\/posts\/6095"}],"collection":[{"href":"https:\/\/rogerbit.com\/wprb\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/rogerbit.com\/wprb\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/rogerbit.com\/wprb\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/rogerbit.com\/wprb\/wp-json\/wp\/v2\/comments?post=6095"}],"version-history":[{"count":1,"href":"https:\/\/rogerbit.com\/wprb\/wp-json\/wp\/v2\/posts\/6095\/revisions"}],"predecessor-version":[{"id":6097,"href":"https:\/\/rogerbit.com\/wprb\/wp-json\/wp\/v2\/posts\/6095\/revisions\/6097"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/rogerbit.com\/wprb\/wp-json\/wp\/v2\/media\/6096"}],"wp:attachment":[{"href":"https:\/\/rogerbit.com\/wprb\/wp-json\/wp\/v2\/media?parent=6095"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/rogerbit.com\/wprb\/wp-json\/wp\/v2\/categories?post=6095"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/rogerbit.com\/wprb\/wp-json\/wp\/v2\/tags?post=6095"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}