{"id":129443,"date":"2022-10-06T19:57:30","date_gmt":"2022-10-06T13:57:30","guid":{"rendered":"http:\/\/rcl-radio.ru\/?p=129443"},"modified":"2022-11-05T10:01:10","modified_gmt":"2022-11-05T04:01:10","slug":"attiny45-0-96%e2%80%b2-i2c-128x64-oled-arduino","status":"publish","type":"post","link":"http:\/\/rcl-radio.ru\/?p=129443","title":{"rendered":"ATtiny45 + 0.96\u2032 I2C 128X64 OLED  (Arduino)"},"content":{"rendered":"<p>\u0414\u0438\u0441\u043f\u043b\u0435\u0439 0.96\u2032 I2C 128X64 OLED \u043d\u0430 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0435 SSD1306 \u0438\u043c\u0435\u0435\u0442 \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u0435 128\u044564 \u043f\u0438\u043a\u0441\u0435\u043b \u0438 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u043a \u043c\u0438\u043a\u0440\u043e\u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0443 \u043f\u043e \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0443 I2C.<\/p>\n<table border=\"1\">\n<tbody>\n<tr>\n<td><a class=\"highslide-image\" href=\"http:\/\/rcl-radio.ru\/wp-content\/uploads\/2022\/01\/%D0%A1%D0%BD%D0%B8%D0%BC%D0%BE%D0%BA-%D1%8D%D0%BA%D1%80%D0%B0%D0%BD%D0%B0-%D0%BE%D1%82-2022-01-27-210731.png\" class=\"highslide-image\" onclick=\"return hs.expand(this);\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-112671\" src=\"http:\/\/rcl-radio.ru\/wp-content\/uploads\/2022\/01\/%D0%A1%D0%BD%D0%B8%D0%BC%D0%BE%D0%BA-%D1%8D%D0%BA%D1%80%D0%B0%D0%BD%D0%B0-%D0%BE%D1%82-2022-01-27-210731.png\" sizes=\"auto, (max-width: 283px) 100vw, 283px\" srcset=\"http:\/\/rcl-radio.ru\/wp-content\/uploads\/2022\/01\/\u0421\u043d\u0438\u043c\u043e\u043a-\u044d\u043a\u0440\u0430\u043d\u0430-\u043e\u0442-2022-01-27-210731.png 283w, http:\/\/rcl-radio.ru\/wp-content\/uploads\/2022\/01\/\u0421\u043d\u0438\u043c\u043e\u043a-\u044d\u043a\u0440\u0430\u043d\u0430-\u043e\u0442-2022-01-27-210731-200x208.png 200w\" alt=\"\" width=\"283\" height=\"295\" \/><\/a><\/td>\n<td><a class=\"highslide-image\" href=\"http:\/\/rcl-radio.ru\/wp-content\/uploads\/2022\/01\/%D0%A1%D0%BD%D0%B8%D0%BC%D0%BE%D0%BA-%D1%8D%D0%BA%D1%80%D0%B0%D0%BD%D0%B0-%D0%BE%D1%82-2022-01-27-210631.png\" class=\"highslide-image\" onclick=\"return hs.expand(this);\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-112672\" src=\"http:\/\/rcl-radio.ru\/wp-content\/uploads\/2022\/01\/%D0%A1%D0%BD%D0%B8%D0%BC%D0%BE%D0%BA-%D1%8D%D0%BA%D1%80%D0%B0%D0%BD%D0%B0-%D0%BE%D1%82-2022-01-27-210631.png\" sizes=\"auto, (max-width: 290px) 100vw, 290px\" srcset=\"http:\/\/rcl-radio.ru\/wp-content\/uploads\/2022\/01\/\u0421\u043d\u0438\u043c\u043e\u043a-\u044d\u043a\u0440\u0430\u043d\u0430-\u043e\u0442-2022-01-27-210631.png 290w, http:\/\/rcl-radio.ru\/wp-content\/uploads\/2022\/01\/\u0421\u043d\u0438\u043c\u043e\u043a-\u044d\u043a\u0440\u0430\u043d\u0430-\u043e\u0442-2022-01-27-210631-200x197.png 200w, http:\/\/rcl-radio.ru\/wp-content\/uploads\/2022\/01\/\u0421\u043d\u0438\u043c\u043e\u043a-\u044d\u043a\u0440\u0430\u043d\u0430-\u043e\u0442-2022-01-27-210631-45x45.png 45w\" alt=\"\" width=\"290\" height=\"285\" \/><\/a><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0434\u0438\u0441\u043f\u043b\u0435\u044f SSD1306:<\/p>\n<ul>\n<li>\u0422\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u044f \u0434\u0438\u0441\u043f\u043b\u0435\u044f: OLED<\/li>\n<li>\u0420\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0434\u0438\u0441\u043f\u043b\u0435\u044f: 128 \u043d\u0430 64 \u0442\u043e\u0447\u043a\u0438<\/li>\n<li>\u0414\u0438\u0430\u0433\u043e\u043d\u0430\u043b\u044c \u0434\u0438\u0441\u043f\u043b\u0435\u044f: 0,96 \u0434\u044e\u0439\u043c\u0430<\/li>\n<li>\u0423\u0433\u043e\u043b \u043e\u0431\u0437\u043e\u0440\u0430: 160\u00b0<\/li>\n<li>\u041d\u0430\u043f\u0440\u044f\u0436\u0435\u043d\u0438\u0435 \u043f\u0438\u0442\u0430\u043d\u0438\u044f: 2.8 \u0412 ~ 5.5 \u0412<\/li>\n<li>\u041c\u043e\u0449\u043d\u043e\u0441\u0442\u044c: 0,08 \u0412\u0442<\/li>\n<li>\u0413\u0430\u0431\u0430\u0440\u0438\u0442\u044b: 27.3 \u043c\u043c \u0445 27.8 \u043c\u043c \u0445 3.7 \u043c\u043c<\/li>\n<\/ul>\n<p>\u041c\u0438\u043a\u0440\u043e\u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440 ATtiny45 \u0438\u043c\u0435\u0435\u0442 \u0432\u0441\u0435\u0433\u043e 4 \u043a\u0411 \u043f\u0430\u043c\u044f\u0442\u0438 \u0434\u043b\u044f \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c, \u0447\u0442\u043e \u043d\u0435 \u0434\u0430\u0435\u0442 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438, \u043d\u0438\u0436\u0435 \u043f\u043e\u043a\u0430\u0437\u0430\u043d \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u0439 \u0441\u043a\u0435\u0442\u0447 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442 \u0432\u0441\u0435\u0433\u043e 1,2 \u043a\u0411 \u043f\u0430\u043c\u044f\u0442\u0438. \u0414\u0430\u043d\u043d\u044b\u0439 \u0441\u043a\u0435\u0442\u0447 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u044c \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u0441\u0438\u043c\u0432\u043e\u043b\u044b \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0439 \u043a\u043e\u0434\u0438\u0440\u043e\u0432\u043a\u0438 ASCII.<\/p>\n<div id=\"marketWidget\"><\/div>\n<p>\u0414\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0438\u043c\u0435\u0435\u0442\u0441\u044f \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043c\u0435\u043d\u044f\u0442\u044c \u044f\u0440\u043a\u043e\u0441\u0442\u044c \u0441\u0432\u0435\u0447\u0435\u043d\u0438\u044f \u0434\u0438\u0441\u043f\u043b\u0435\u044f, \u0440\u0435\u0436\u0438\u043c \u0438\u043d\u0432\u0435\u0440\u0441\u0438\u0438.<\/p>\n<p><a href=\"http:\/\/rcl-radio.ru\/wp-content\/uploads\/2022\/10\/\u0421\u043d\u0438\u043c\u043e\u043a-\u044d\u043a\u0440\u0430\u043d\u0430-\u043e\u0442-2022-10-06-19-55-02.png\" class=\"highslide-image\" onclick=\"return hs.expand(this);\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-129444\" src=\"http:\/\/rcl-radio.ru\/wp-content\/uploads\/2022\/10\/\u0421\u043d\u0438\u043c\u043e\u043a-\u044d\u043a\u0440\u0430\u043d\u0430-\u043e\u0442-2022-10-06-19-55-02.png\" alt=\"\" width=\"530\" height=\"264\" srcset=\"http:\/\/rcl-radio.ru\/wp-content\/uploads\/2022\/10\/\u0421\u043d\u0438\u043c\u043e\u043a-\u044d\u043a\u0440\u0430\u043d\u0430-\u043e\u0442-2022-10-06-19-55-02.png 530w, http:\/\/rcl-radio.ru\/wp-content\/uploads\/2022\/10\/\u0421\u043d\u0438\u043c\u043e\u043a-\u044d\u043a\u0440\u0430\u043d\u0430-\u043e\u0442-2022-10-06-19-55-02-500x249.png 500w, http:\/\/rcl-radio.ru\/wp-content\/uploads\/2022\/10\/\u0421\u043d\u0438\u043c\u043e\u043a-\u044d\u043a\u0440\u0430\u043d\u0430-\u043e\u0442-2022-10-06-19-55-02-200x100.png 200w\" sizes=\"auto, (max-width: 530px) 100vw, 530px\" \/><\/a><\/p>\n<table style=\"border-collapse: collapse; width: 100%;\" border=\"1\">\n<tbody>\n<tr>\n<td style=\"width: 50%;\"><a href=\"http:\/\/rcl-radio.ru\/wp-content\/uploads\/2022\/10\/\u0421\u043d\u0438\u043c\u043e\u043a-\u044d\u043a\u0440\u0430\u043d\u0430-\u043e\u0442-2022-10-06-19-55-50.png\" class=\"highslide-image\" onclick=\"return hs.expand(this);\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-129446\" src=\"http:\/\/rcl-radio.ru\/wp-content\/uploads\/2022\/10\/\u0421\u043d\u0438\u043c\u043e\u043a-\u044d\u043a\u0440\u0430\u043d\u0430-\u043e\u0442-2022-10-06-19-55-50.png\" alt=\"\" width=\"202\" height=\"205\" srcset=\"http:\/\/rcl-radio.ru\/wp-content\/uploads\/2022\/10\/\u0421\u043d\u0438\u043c\u043e\u043a-\u044d\u043a\u0440\u0430\u043d\u0430-\u043e\u0442-2022-10-06-19-55-50.png 202w, http:\/\/rcl-radio.ru\/wp-content\/uploads\/2022\/10\/\u0421\u043d\u0438\u043c\u043e\u043a-\u044d\u043a\u0440\u0430\u043d\u0430-\u043e\u0442-2022-10-06-19-55-50-200x203.png 200w\" sizes=\"auto, (max-width: 202px) 100vw, 202px\" \/><\/a><\/td>\n<td style=\"width: 50%;\"><a href=\"http:\/\/rcl-radio.ru\/wp-content\/uploads\/2022\/10\/\u0421\u043d\u0438\u043c\u043e\u043a-\u044d\u043a\u0440\u0430\u043d\u0430-\u043e\u0442-2022-10-06-19-56-02.png\" class=\"highslide-image\" onclick=\"return hs.expand(this);\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-129445\" src=\"http:\/\/rcl-radio.ru\/wp-content\/uploads\/2022\/10\/\u0421\u043d\u0438\u043c\u043e\u043a-\u044d\u043a\u0440\u0430\u043d\u0430-\u043e\u0442-2022-10-06-19-56-02.png\" alt=\"\" width=\"165\" height=\"154\" \/><\/a><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<pre class=\"actionscript\" style=\"font-family: monospace; font-size: 10px;\"><span style=\"color: #808080; font-style: italic;\">#define I2C_SDA         PB3                  <\/span>\r\n<span style=\"color: #808080; font-style: italic;\">#define I2C_SCL         PB4    <\/span>\r\n<span style=\"color: #808080; font-style: italic;\">#define OLED_ADDR       0x78  \/\/ OLED write address       <\/span>\r\n\u00a0\r\n<span style=\"color: #808080; font-style: italic;\">#include &lt;avr\/io.h&gt;<\/span>\r\n<span style=\"color: #808080; font-style: italic;\">#include &lt;util\/delay.h&gt;<\/span>\r\n\u00a0\r\n<span style=\"color: #808080; font-style: italic;\">\/\/ Project Files (Github):  https:\/\/github.com\/wagiminator\/ATtiny13-TinyOLEDdemo<\/span>\r\n<span style=\"color: #808080; font-style: italic;\">\/\/ License: http:\/\/creativecommons.org\/licenses\/by-sa\/3.0\/<\/span>\r\n\u00a0\r\nconst char Message1<span style=\"color: #66cc66;\">[<\/span><span style=\"color: #66cc66;\">]<\/span> PROGMEM = <span style=\"color: #ff0000;\">\"RCL-RADIO.RU\"<\/span>;\r\nconst char Message2<span style=\"color: #66cc66;\">[<\/span><span style=\"color: #66cc66;\">]<\/span> PROGMEM = <span style=\"color: #ff0000;\">\"OLED 0.96\"<\/span>;\r\nconst char Message3<span style=\"color: #66cc66;\">[<\/span><span style=\"color: #66cc66;\">]<\/span> PROGMEM = <span style=\"color: #ff0000;\">\"SSD1306\"<\/span>;\r\nconst char Message4<span style=\"color: #66cc66;\">[<\/span><span style=\"color: #66cc66;\">]<\/span> PROGMEM = <span style=\"color: #ff0000;\">\"Line \"<\/span>;\r\nconst char Message5<span style=\"color: #66cc66;\">[<\/span><span style=\"color: #66cc66;\">]<\/span> PROGMEM = <span style=\"color: #ff0000;\">\"&lt;--------***--------&gt;\"<\/span>;\r\n<span style=\"color: #0066cc;\">int<\/span> n;\r\n\u00a0\r\n<span style=\"color: #0066cc;\">int<\/span> main<span style=\"color: #66cc66;\">(<\/span><span style=\"color: #0066cc;\">void<\/span><span style=\"color: #66cc66;\">)<\/span> <span style=\"color: #66cc66;\">{<\/span>\r\n  _delay_ms<span style=\"color: #66cc66;\">(<\/span><span style=\"color: #cc66cc;\">200<\/span><span style=\"color: #66cc66;\">)<\/span>;\r\n  OLED_init<span style=\"color: #66cc66;\">(<\/span><span style=\"color: #66cc66;\">)<\/span>;\r\n  OLED_brig<span style=\"color: #66cc66;\">(<\/span><span style=\"color: #cc66cc;\">150<\/span><span style=\"color: #66cc66;\">)<\/span>;<span style=\"color: #808080; font-style: italic;\">\/\/ 0...255<\/span>\r\n  OLED_inver<span style=\"color: #66cc66;\">(<\/span><span style=\"color: #cc66cc;\">0<\/span><span style=\"color: #66cc66;\">)<\/span>; <span style=\"color: #808080; font-style: italic;\">\/\/ invers<\/span>\r\n  OLED_clear<span style=\"color: #66cc66;\">(<\/span><span style=\"color: #66cc66;\">)<\/span>; \r\n\u00a0\r\n  <span style=\"color: #b1b100;\">while<\/span><span style=\"color: #66cc66;\">(<\/span><span style=\"color: #cc66cc;\">1<\/span><span style=\"color: #66cc66;\">)<\/span> <span style=\"color: #66cc66;\">{<\/span>                                                  \r\n  <span style=\"color: #808080; font-style: italic;\">\/\/  OLED_clear();                       <\/span>\r\n    OLED_cursor<span style=\"color: #66cc66;\">(<\/span><span style=\"color: #cc66cc;\">0<\/span>, <span style=\"color: #cc66cc;\">0<\/span><span style=\"color: #66cc66;\">)<\/span>;                \r\n    OLED_printP<span style=\"color: #66cc66;\">(<\/span>Message1<span style=\"color: #66cc66;\">)<\/span>; \r\n    OLED_cursor<span style=\"color: #66cc66;\">(<\/span><span style=\"color: #cc66cc;\">0<\/span>, <span style=\"color: #cc66cc;\">1<\/span><span style=\"color: #66cc66;\">)<\/span>;                \r\n    OLED_printP<span style=\"color: #66cc66;\">(<\/span>Message2<span style=\"color: #66cc66;\">)<\/span>;  \r\n    OLED_cursor<span style=\"color: #66cc66;\">(<\/span><span style=\"color: #cc66cc;\">0<\/span>, <span style=\"color: #cc66cc;\">2<\/span><span style=\"color: #66cc66;\">)<\/span>;                \r\n    OLED_printP<span style=\"color: #66cc66;\">(<\/span>Message3<span style=\"color: #66cc66;\">)<\/span>;               \r\n    OLED_cursor<span style=\"color: #66cc66;\">(<\/span><span style=\"color: #cc66cc;\">0<\/span>, <span style=\"color: #cc66cc;\">3<\/span><span style=\"color: #66cc66;\">)<\/span>;\r\n    OLED_printP<span style=\"color: #66cc66;\">(<\/span>Message5<span style=\"color: #66cc66;\">)<\/span>;\r\n    OLED_cursor<span style=\"color: #66cc66;\">(<\/span><span style=\"color: #cc66cc;\">0<\/span>, <span style=\"color: #cc66cc;\">4<\/span><span style=\"color: #66cc66;\">)<\/span>;\r\n    OLED_printP<span style=\"color: #66cc66;\">(<\/span>Message4<span style=\"color: #66cc66;\">)<\/span>;OLED_num<span style=\"color: #66cc66;\">(<\/span><span style=\"color: #cc66cc;\">5<\/span><span style=\"color: #66cc66;\">)<\/span>;\r\n    OLED_cursor<span style=\"color: #66cc66;\">(<\/span><span style=\"color: #cc66cc;\">0<\/span>, <span style=\"color: #cc66cc;\">5<\/span><span style=\"color: #66cc66;\">)<\/span>;\r\n    OLED_printP<span style=\"color: #66cc66;\">(<\/span>Message4<span style=\"color: #66cc66;\">)<\/span>;OLED_num<span style=\"color: #66cc66;\">(<\/span><span style=\"color: #cc66cc;\">6<\/span><span style=\"color: #66cc66;\">)<\/span>;\r\n    OLED_cursor<span style=\"color: #66cc66;\">(<\/span><span style=\"color: #cc66cc;\">0<\/span>, <span style=\"color: #cc66cc;\">6<\/span><span style=\"color: #66cc66;\">)<\/span>;\r\n    OLED_printP<span style=\"color: #66cc66;\">(<\/span>Message4<span style=\"color: #66cc66;\">)<\/span>;OLED_num<span style=\"color: #66cc66;\">(<\/span><span style=\"color: #cc66cc;\">7<\/span><span style=\"color: #66cc66;\">)<\/span>;\r\n    OLED_cursor<span style=\"color: #66cc66;\">(<\/span><span style=\"color: #cc66cc;\">0<\/span>, <span style=\"color: #cc66cc;\">7<\/span><span style=\"color: #66cc66;\">)<\/span>;\r\n    OLED_printP<span style=\"color: #66cc66;\">(<\/span>Message4<span style=\"color: #66cc66;\">)<\/span>;OLED_num<span style=\"color: #66cc66;\">(<\/span><span style=\"color: #cc66cc;\">8<\/span><span style=\"color: #66cc66;\">)<\/span>;\r\n\u00a0\r\n    n++;\r\n    <span style=\"color: #b1b100;\">if<\/span><span style=\"color: #66cc66;\">(<\/span>n<span style=\"color: #66cc66;\">&gt;<\/span><span style=\"color: #cc66cc;\">50<\/span><span style=\"color: #66cc66;\">)<\/span><span style=\"color: #66cc66;\">{<\/span>n=<span style=\"color: #cc66cc;\">0<\/span>;<span style=\"color: #66cc66;\">}<\/span>\r\n    OLED_cursor<span style=\"color: #66cc66;\">(<\/span><span style=\"color: #cc66cc;\">70<\/span>, <span style=\"color: #cc66cc;\">7<\/span><span style=\"color: #66cc66;\">)<\/span>;\r\n    OLED_num<span style=\"color: #66cc66;\">(<\/span>n<span style=\"color: #66cc66;\">\/<\/span><span style=\"color: #cc66cc;\">10<\/span><span style=\"color: #66cc66;\">)<\/span>;OLED_num<span style=\"color: #66cc66;\">(<\/span>n<span style=\"color: #66cc66;\">%<\/span>10<span style=\"color: #66cc66;\">)<\/span>;\r\n    _delay_ms<span style=\"color: #66cc66;\">(<\/span><span style=\"color: #cc66cc;\">100<\/span><span style=\"color: #66cc66;\">)<\/span>;                      \r\n  <span style=\"color: #66cc66;\">}<\/span> \r\n<span style=\"color: #66cc66;\">}<\/span> \r\n\u00a0\r\n\u00a0\r\n<span style=\"color: #808080; font-style: italic;\">#define I2C_SDA_HIGH()  DDRB &amp;= ~(1&lt;&lt;I2C_SDA)<\/span>\r\n<span style=\"color: #808080; font-style: italic;\">#define I2C_SDA_LOW()   DDRB |=  (1&lt;&lt;I2C_SDA) <\/span>\r\n<span style=\"color: #808080; font-style: italic;\">#define I2C_SCL_HIGH()  DDRB &amp;= ~(1&lt;&lt;I2C_SCL) <\/span>\r\n<span style=\"color: #808080; font-style: italic;\">#define I2C_SCL_LOW()   DDRB |=  (1&lt;&lt;I2C_SCL) <\/span>\r\n<span style=\"color: #808080; font-style: italic;\">#define OLED_CMD_MODE   0x00                  <\/span>\r\n<span style=\"color: #808080; font-style: italic;\">#define OLED_DAT_MODE   0x40  <\/span>\r\nconst uint8_t OLED_INIT_CMD<span style=\"color: #66cc66;\">[<\/span><span style=\"color: #66cc66;\">]<\/span> PROGMEM = <span style=\"color: #66cc66;\">{<\/span>0xA8, 0x3F, 0x8D, 0x14, 0xAF, 0xA1, 0xC8<span style=\"color: #66cc66;\">}<\/span>;\r\n\u00a0\r\n<span style=\"color: #0066cc;\">void<\/span> I2C_init<span style=\"color: #66cc66;\">(<\/span><span style=\"color: #0066cc;\">void<\/span><span style=\"color: #66cc66;\">)<\/span><span style=\"color: #66cc66;\">{<\/span>DDRB  <span style=\"color: #66cc66;\">&amp;<\/span>= ~<span style=\"color: #66cc66;\">(<\/span><span style=\"color: #66cc66;\">(<\/span><span style=\"color: #cc66cc;\">1<\/span><span style=\"color: #66cc66;\">&lt;&lt;<\/span>I2C_SDA<span style=\"color: #66cc66;\">)<\/span><span style=\"color: #66cc66;\">|<\/span><span style=\"color: #66cc66;\">(<\/span><span style=\"color: #cc66cc;\">1<\/span><span style=\"color: #66cc66;\">&lt;&lt;<\/span>I2C_SCL<span style=\"color: #66cc66;\">)<\/span><span style=\"color: #66cc66;\">)<\/span>;PORTB <span style=\"color: #66cc66;\">&amp;<\/span>= ~<span style=\"color: #66cc66;\">(<\/span><span style=\"color: #66cc66;\">(<\/span><span style=\"color: #cc66cc;\">1<\/span><span style=\"color: #66cc66;\">&lt;&lt;<\/span>I2C_SDA<span style=\"color: #66cc66;\">)<\/span><span style=\"color: #66cc66;\">|<\/span><span style=\"color: #66cc66;\">(<\/span><span style=\"color: #cc66cc;\">1<\/span><span style=\"color: #66cc66;\">&lt;&lt;<\/span>I2C_SCL<span style=\"color: #66cc66;\">)<\/span><span style=\"color: #66cc66;\">)<\/span>;<span style=\"color: #66cc66;\">}<\/span>\r\n<span style=\"color: #0066cc;\">void<\/span> I2C_write<span style=\"color: #66cc66;\">(<\/span>uint8_t <span style=\"color: #0066cc;\">data<\/span><span style=\"color: #66cc66;\">)<\/span> <span style=\"color: #66cc66;\">{<\/span>\r\n  <span style=\"color: #b1b100;\">for<\/span><span style=\"color: #66cc66;\">(<\/span>uint8_t i = <span style=\"color: #cc66cc;\">8<\/span>; i; i--<span style=\"color: #66cc66;\">)<\/span><span style=\"color: #66cc66;\">{<\/span>\r\n    I2C_SDA_LOW<span style=\"color: #66cc66;\">(<\/span><span style=\"color: #66cc66;\">)<\/span>;                       \r\n    <span style=\"color: #b1b100;\">if<\/span> <span style=\"color: #66cc66;\">(<\/span><span style=\"color: #0066cc;\">data<\/span> <span style=\"color: #66cc66;\">&amp;<\/span> 0x80<span style=\"color: #66cc66;\">)<\/span> I2C_SDA_HIGH<span style=\"color: #66cc66;\">(<\/span><span style=\"color: #66cc66;\">)<\/span>;   \r\n    I2C_SCL_HIGH<span style=\"color: #66cc66;\">(<\/span><span style=\"color: #66cc66;\">)<\/span>;data<span style=\"color: #66cc66;\">&lt;&lt;<\/span>=<span style=\"color: #cc66cc;\">1<\/span>;I2C_SCL_LOW<span style=\"color: #66cc66;\">(<\/span><span style=\"color: #66cc66;\">)<\/span>;<span style=\"color: #66cc66;\">}<\/span>\r\n  I2C_SDA_HIGH<span style=\"color: #66cc66;\">(<\/span><span style=\"color: #66cc66;\">)<\/span>;I2C_SCL_HIGH<span style=\"color: #66cc66;\">(<\/span><span style=\"color: #66cc66;\">)<\/span>;asm<span style=\"color: #66cc66;\">(<\/span><span style=\"color: #ff0000;\">\"nop\"<\/span><span style=\"color: #66cc66;\">)<\/span>;I2C_SCL_LOW<span style=\"color: #66cc66;\">(<\/span><span style=\"color: #66cc66;\">)<\/span>;<span style=\"color: #66cc66;\">}<\/span>\r\n<span style=\"color: #0066cc;\">void<\/span> I2C_start<span style=\"color: #66cc66;\">(<\/span>uint8_t addr<span style=\"color: #66cc66;\">)<\/span><span style=\"color: #66cc66;\">{<\/span>I2C_SDA_LOW<span style=\"color: #66cc66;\">(<\/span><span style=\"color: #66cc66;\">)<\/span>;I2C_SCL_LOW<span style=\"color: #66cc66;\">(<\/span><span style=\"color: #66cc66;\">)<\/span>;I2C_write<span style=\"color: #66cc66;\">(<\/span>addr<span style=\"color: #66cc66;\">)<\/span>;<span style=\"color: #66cc66;\">}<\/span>\r\n<span style=\"color: #0066cc;\">void<\/span> I2C_stop<span style=\"color: #66cc66;\">(<\/span><span style=\"color: #0066cc;\">void<\/span><span style=\"color: #66cc66;\">)<\/span><span style=\"color: #66cc66;\">{<\/span>I2C_SDA_LOW<span style=\"color: #66cc66;\">(<\/span><span style=\"color: #66cc66;\">)<\/span>;I2C_SCL_HIGH<span style=\"color: #66cc66;\">(<\/span><span style=\"color: #66cc66;\">)<\/span>;I2C_SDA_HIGH<span style=\"color: #66cc66;\">(<\/span><span style=\"color: #66cc66;\">)<\/span>;<span style=\"color: #66cc66;\">}<\/span>\r\n\u00a0\r\nconst uint8_t OLED_FONT<span style=\"color: #66cc66;\">[<\/span><span style=\"color: #66cc66;\">]<\/span> PROGMEM = <span style=\"color: #66cc66;\">{<\/span>\r\n   0x00, 0x00, 0x00, 0x00, 0x00, <span style=\"color: #808080; font-style: italic;\">\/\/ sp<\/span>\r\n   0x00, 0x00, 0x5F, 0x00, 0x00, <span style=\"color: #808080; font-style: italic;\">\/\/ !<\/span>\r\n   0x00, 0x03, 0x00, 0x03, 0x00, <span style=\"color: #808080; font-style: italic;\">\/\/ \"<\/span>\r\n   0x14, 0x3E, 0x14, 0x3E, 0x14, <span style=\"color: #808080; font-style: italic;\">\/\/ #<\/span>\r\n   0x24, 0x2A, 0x7F, 0x2A, 0x12, <span style=\"color: #808080; font-style: italic;\">\/\/ $<\/span>\r\n   0x43, 0x33, 0x08, 0x66, 0x61, <span style=\"color: #808080; font-style: italic;\">\/\/ %<\/span>\r\n   0x36, 0x49, 0x55, 0x22, 0x50, <span style=\"color: #808080; font-style: italic;\">\/\/ &amp;<\/span>\r\n   0x00, 0x05, 0x03, 0x00, 0x00, <span style=\"color: #808080; font-style: italic;\">\/\/ '<\/span>\r\n   0x00, 0x1C, 0x22, 0x41, 0x00, <span style=\"color: #808080; font-style: italic;\">\/\/ (<\/span>\r\n   0x00, 0x41, 0x22, 0x1C, 0x00, <span style=\"color: #808080; font-style: italic;\">\/\/ )<\/span>\r\n   0x14, 0x08, 0x3E, 0x08, 0x14, <span style=\"color: #808080; font-style: italic;\">\/\/ *<\/span>\r\n   0x08, 0x08, 0x3E, 0x08, 0x08, <span style=\"color: #808080; font-style: italic;\">\/\/ +<\/span>\r\n   0x00, 0x50, 0x30, 0x00, 0x00, <span style=\"color: #808080; font-style: italic;\">\/\/ ,<\/span>\r\n   0x08, 0x08, 0x08, 0x08, 0x08, <span style=\"color: #808080; font-style: italic;\">\/\/ -<\/span>\r\n   0x00, 0x60, 0x60, 0x00, 0x00, <span style=\"color: #808080; font-style: italic;\">\/\/ .<\/span>\r\n   0x20, 0x10, 0x08, 0x04, 0x02, <span style=\"color: #808080; font-style: italic;\">\/\/ \/<\/span>\r\n   0x3E, 0x51, 0x49, 0x45, 0x3E, <span style=\"color: #808080; font-style: italic;\">\/\/ 0<\/span>\r\n   0x00, 0x04, 0x02, 0x7F, 0x00, <span style=\"color: #808080; font-style: italic;\">\/\/ 1<\/span>\r\n   0x42, 0x61, 0x51, 0x49, 0x46, <span style=\"color: #808080; font-style: italic;\">\/\/ 2<\/span>\r\n   0x22, 0x41, 0x49, 0x49, 0x36, <span style=\"color: #808080; font-style: italic;\">\/\/ 3<\/span>\r\n   0x18, 0x14, 0x12, 0x7F, 0x10, <span style=\"color: #808080; font-style: italic;\">\/\/ 4<\/span>\r\n   0x27, 0x45, 0x45, 0x45, 0x39, <span style=\"color: #808080; font-style: italic;\">\/\/ 5<\/span>\r\n   0x3E, 0x49, 0x49, 0x49, 0x32, <span style=\"color: #808080; font-style: italic;\">\/\/ 6<\/span>\r\n   0x01, 0x01, 0x71, 0x09, 0x07, <span style=\"color: #808080; font-style: italic;\">\/\/ 7<\/span>\r\n   0x36, 0x49, 0x49, 0x49, 0x36, <span style=\"color: #808080; font-style: italic;\">\/\/ 8<\/span>\r\n   0x26, 0x49, 0x49, 0x49, 0x3E, <span style=\"color: #808080; font-style: italic;\">\/\/ 9<\/span>\r\n   0x00, 0x36, 0x36, 0x00, 0x00, <span style=\"color: #808080; font-style: italic;\">\/\/ :<\/span>\r\n   0x00, 0x56, 0x36, 0x00, 0x00, <span style=\"color: #808080; font-style: italic;\">\/\/ ;<\/span>\r\n   0x08, 0x14, 0x22, 0x41, 0x00, <span style=\"color: #808080; font-style: italic;\">\/\/ &lt;<\/span>\r\n   0x14, 0x14, 0x14, 0x14, 0x14, <span style=\"color: #808080; font-style: italic;\">\/\/ =<\/span>\r\n   0x00, 0x41, 0x22, 0x14, 0x08, <span style=\"color: #808080; font-style: italic;\">\/\/ &gt;<\/span>\r\n   0x02, 0x01, 0x51, 0x09, 0x06, <span style=\"color: #808080; font-style: italic;\">\/\/ ?<\/span>\r\n   0x3E, 0x41, 0x59, 0x55, 0x5E, <span style=\"color: #808080; font-style: italic;\">\/\/ @<\/span>\r\n   0x7E, 0x09, 0x09, 0x09, 0x7E, <span style=\"color: #808080; font-style: italic;\">\/\/ A<\/span>\r\n   0x7F, 0x49, 0x49, 0x49, 0x36, <span style=\"color: #808080; font-style: italic;\">\/\/ B<\/span>\r\n   0x3E, 0x41, 0x41, 0x41, 0x22, <span style=\"color: #808080; font-style: italic;\">\/\/ C<\/span>\r\n   0x7F, 0x41, 0x41, 0x41, 0x3E, <span style=\"color: #808080; font-style: italic;\">\/\/ D<\/span>\r\n   0x7F, 0x49, 0x49, 0x49, 0x41, <span style=\"color: #808080; font-style: italic;\">\/\/ E<\/span>\r\n   0x7F, 0x09, 0x09, 0x09, 0x01, <span style=\"color: #808080; font-style: italic;\">\/\/ F<\/span>\r\n   0x3E, 0x41, 0x41, 0x49, 0x3A, <span style=\"color: #808080; font-style: italic;\">\/\/ G<\/span>\r\n   0x7F, 0x08, 0x08, 0x08, 0x7F, <span style=\"color: #808080; font-style: italic;\">\/\/ H<\/span>\r\n   0x00, 0x41, 0x7F, 0x41, 0x00, <span style=\"color: #808080; font-style: italic;\">\/\/ I<\/span>\r\n   0x30, 0x40, 0x40, 0x40, 0x3F, <span style=\"color: #808080; font-style: italic;\">\/\/ J<\/span>\r\n   0x7F, 0x08, 0x14, 0x22, 0x41, <span style=\"color: #808080; font-style: italic;\">\/\/ K<\/span>\r\n   0x7F, 0x40, 0x40, 0x40, 0x40, <span style=\"color: #808080; font-style: italic;\">\/\/ L<\/span>\r\n   0x7F, 0x02, 0x0C, 0x02, 0x7F, <span style=\"color: #808080; font-style: italic;\">\/\/ M<\/span>\r\n   0x7F, 0x02, 0x04, 0x08, 0x7F, <span style=\"color: #808080; font-style: italic;\">\/\/ N<\/span>\r\n   0x3E, 0x41, 0x41, 0x41, 0x3E, <span style=\"color: #808080; font-style: italic;\">\/\/ O<\/span>\r\n   0x7F, 0x09, 0x09, 0x09, 0x06, <span style=\"color: #808080; font-style: italic;\">\/\/ P<\/span>\r\n   0x1E, 0x21, 0x21, 0x21, 0x5E, <span style=\"color: #808080; font-style: italic;\">\/\/ Q<\/span>\r\n   0x7F, 0x09, 0x09, 0x09, 0x76, <span style=\"color: #808080; font-style: italic;\">\/\/ R<\/span>\r\n   0x26, 0x49, 0x49, 0x49, 0x32, <span style=\"color: #808080; font-style: italic;\">\/\/ S<\/span>\r\n   0x01, 0x01, 0x7F, 0x01, 0x01, <span style=\"color: #808080; font-style: italic;\">\/\/ T<\/span>\r\n   0x3F, 0x40, 0x40, 0x40, 0x3F, <span style=\"color: #808080; font-style: italic;\">\/\/ U<\/span>\r\n   0x1F, 0x20, 0x40, 0x20, 0x1F, <span style=\"color: #808080; font-style: italic;\">\/\/ V<\/span>\r\n   0x7F, 0x20, 0x10, 0x20, 0x7F, <span style=\"color: #808080; font-style: italic;\">\/\/ W<\/span>\r\n   0x41, 0x22, 0x1C, 0x22, 0x41, <span style=\"color: #808080; font-style: italic;\">\/\/ X<\/span>\r\n   0x07, 0x08, 0x70, 0x08, 0x07, <span style=\"color: #808080; font-style: italic;\">\/\/ Y<\/span>\r\n   0x61, 0x51, 0x49, 0x45, 0x43, <span style=\"color: #808080; font-style: italic;\">\/\/ Z<\/span>\r\n   0x00, 0x7F, 0x41, 0x00, 0x00, <span style=\"color: #808080; font-style: italic;\">\/\/ [<\/span>\r\n   0x02, 0x04, 0x08, 0x10, 0x20, <span style=\"color: #808080; font-style: italic;\">\/\/ \"\/\"<\/span>\r\n   0x00, 0x00, 0x41, 0x7F, 0x00, <span style=\"color: #808080; font-style: italic;\">\/\/ ]<\/span>\r\n   0x04, 0x02, 0x01, 0x02, 0x04, <span style=\"color: #808080; font-style: italic;\">\/\/ ^<\/span>\r\n   0x40, 0x40, 0x40, 0x40, 0x40, <span style=\"color: #808080; font-style: italic;\">\/\/ _<\/span>\r\n   0x00, 0x01, 0x02, 0x04, 0x00, <span style=\"color: #808080; font-style: italic;\">\/\/ `<\/span>\r\n   0x20, 0x54, 0x54, 0x54, 0x78, <span style=\"color: #808080; font-style: italic;\">\/\/ a<\/span>\r\n   0x7F, 0x44, 0x44, 0x44, 0x38, <span style=\"color: #808080; font-style: italic;\">\/\/ b<\/span>\r\n   0x38, 0x44, 0x44, 0x44, 0x44, <span style=\"color: #808080; font-style: italic;\">\/\/ c<\/span>\r\n   0x38, 0x44, 0x44, 0x44, 0x7F, <span style=\"color: #808080; font-style: italic;\">\/\/ d<\/span>\r\n   0x38, 0x54, 0x54, 0x54, 0x18, <span style=\"color: #808080; font-style: italic;\">\/\/ e<\/span>\r\n   0x04, 0x04, 0x7E, 0x05, 0x05, <span style=\"color: #808080; font-style: italic;\">\/\/ f<\/span>\r\n   0x08, 0x54, 0x54, 0x54, 0x3C, <span style=\"color: #808080; font-style: italic;\">\/\/ g<\/span>\r\n   0x7F, 0x08, 0x04, 0x04, 0x78, <span style=\"color: #808080; font-style: italic;\">\/\/ h<\/span>\r\n   0x00, 0x44, 0x7D, 0x40, 0x00, <span style=\"color: #808080; font-style: italic;\">\/\/ i<\/span>\r\n   0x20, 0x40, 0x44, 0x3D, 0x00, <span style=\"color: #808080; font-style: italic;\">\/\/ j<\/span>\r\n   0x7F, 0x10, 0x28, 0x44, 0x00, <span style=\"color: #808080; font-style: italic;\">\/\/ k<\/span>\r\n   0x00, 0x41, 0x7F, 0x40, 0x00, <span style=\"color: #808080; font-style: italic;\">\/\/ l<\/span>\r\n   0x7C, 0x04, 0x78, 0x04, 0x78, <span style=\"color: #808080; font-style: italic;\">\/\/ m<\/span>\r\n   0x7C, 0x08, 0x04, 0x04, 0x78, <span style=\"color: #808080; font-style: italic;\">\/\/ n<\/span>\r\n   0x38, 0x44, 0x44, 0x44, 0x38, <span style=\"color: #808080; font-style: italic;\">\/\/ o<\/span>\r\n   0x7C, 0x14, 0x14, 0x14, 0x08, <span style=\"color: #808080; font-style: italic;\">\/\/ p<\/span>\r\n   0x08, 0x14, 0x14, 0x14, 0x7C, <span style=\"color: #808080; font-style: italic;\">\/\/ q<\/span>\r\n   0x00, 0x7C, 0x08, 0x04, 0x04, <span style=\"color: #808080; font-style: italic;\">\/\/ r<\/span>\r\n   0x48, 0x54, 0x54, 0x54, 0x20, <span style=\"color: #808080; font-style: italic;\">\/\/ s<\/span>\r\n   0x04, 0x04, 0x3F, 0x44, 0x44, <span style=\"color: #808080; font-style: italic;\">\/\/ t<\/span>\r\n   0x3C, 0x40, 0x40, 0x20, 0x7C, <span style=\"color: #808080; font-style: italic;\">\/\/ u<\/span>\r\n   0x1C, 0x20, 0x40, 0x20, 0x1C, <span style=\"color: #808080; font-style: italic;\">\/\/ v<\/span>\r\n   0x3C, 0x40, 0x30, 0x40, 0x3C, <span style=\"color: #808080; font-style: italic;\">\/\/ w<\/span>\r\n   0x44, 0x28, 0x10, 0x28, 0x44, <span style=\"color: #808080; font-style: italic;\">\/\/ x<\/span>\r\n   0x0C, 0x50, 0x50, 0x50, 0x3C, <span style=\"color: #808080; font-style: italic;\">\/\/ y<\/span>\r\n   0x44, 0x64, 0x54, 0x4C, 0x44, <span style=\"color: #808080; font-style: italic;\">\/\/ z<\/span>\r\n   0x00, 0x08, 0x36, 0x41, 0x41, <span style=\"color: #808080; font-style: italic;\">\/\/ {<\/span>\r\n   0x00, 0x00, 0x7F, 0x00, 0x00, <span style=\"color: #808080; font-style: italic;\">\/\/ |<\/span>\r\n   0x41, 0x41, 0x36, 0x08, 0x00, <span style=\"color: #808080; font-style: italic;\">\/\/ }<\/span>\r\n   0x02, 0x01, 0x02, 0x04, 0x02, <span style=\"color: #808080; font-style: italic;\">\/\/ ~<\/span>\r\n<span style=\"color: #66cc66;\">}<\/span>;\r\n\u00a0\r\n<span style=\"color: #0066cc;\">void<\/span> OLED_init<span style=\"color: #66cc66;\">(<\/span><span style=\"color: #0066cc;\">void<\/span><span style=\"color: #66cc66;\">)<\/span> <span style=\"color: #66cc66;\">{<\/span>\r\n  I2C_init<span style=\"color: #66cc66;\">(<\/span><span style=\"color: #66cc66;\">)<\/span>;                             \r\n  I2C_start<span style=\"color: #66cc66;\">(<\/span>OLED_ADDR<span style=\"color: #66cc66;\">)<\/span>;                   \r\n  I2C_write<span style=\"color: #66cc66;\">(<\/span>OLED_CMD_MODE<span style=\"color: #66cc66;\">)<\/span>;               \r\n  <span style=\"color: #b1b100;\">for<\/span> <span style=\"color: #66cc66;\">(<\/span>uint8_t i = <span style=\"color: #cc66cc;\">0<\/span>; i <span style=\"color: #66cc66;\">&lt;<\/span> <span style=\"color: #cc66cc;\">7<\/span>; i++<span style=\"color: #66cc66;\">)<\/span> I2C_write<span style=\"color: #66cc66;\">(<\/span>pgm_read_byte<span style=\"color: #66cc66;\">(<\/span><span style=\"color: #66cc66;\">&amp;<\/span>OLED_INIT_CMD<span style=\"color: #66cc66;\">[<\/span>i<span style=\"color: #66cc66;\">]<\/span><span style=\"color: #66cc66;\">)<\/span><span style=\"color: #66cc66;\">)<\/span>; \r\n  I2C_stop<span style=\"color: #66cc66;\">(<\/span><span style=\"color: #66cc66;\">)<\/span>;                            \r\n<span style=\"color: #66cc66;\">}<\/span>\r\n\u00a0\r\n<span style=\"color: #0066cc;\">void<\/span> OLED_printC<span style=\"color: #66cc66;\">(<\/span>char ch<span style=\"color: #66cc66;\">)<\/span> <span style=\"color: #66cc66;\">{<\/span>\r\n  uint16_t offset = ch - <span style=\"color: #cc66cc;\">32<\/span>;             \r\n  offset += offset <span style=\"color: #66cc66;\">&lt;&lt;<\/span> <span style=\"color: #cc66cc;\">2<\/span>;                \r\n  I2C_write<span style=\"color: #66cc66;\">(<\/span>0x00<span style=\"color: #66cc66;\">)<\/span>;        \r\n  <span style=\"color: #b1b100;\">for<\/span><span style=\"color: #66cc66;\">(<\/span>uint8_t i=<span style=\"color: #cc66cc;\">5<\/span>; i; i--<span style=\"color: #66cc66;\">)<\/span> I2C_write<span style=\"color: #66cc66;\">(<\/span>pgm_read_byte<span style=\"color: #66cc66;\">(<\/span><span style=\"color: #66cc66;\">&amp;<\/span>OLED_FONT<span style=\"color: #66cc66;\">[<\/span>offset++<span style=\"color: #66cc66;\">]<\/span><span style=\"color: #66cc66;\">)<\/span><span style=\"color: #66cc66;\">)<\/span>; \r\n<span style=\"color: #66cc66;\">}<\/span>\r\n\u00a0\r\n<span style=\"color: #0066cc;\">void<\/span> OLED_printP<span style=\"color: #66cc66;\">(<\/span>const char<span style=\"color: #66cc66;\">*<\/span> p<span style=\"color: #66cc66;\">)<\/span> <span style=\"color: #66cc66;\">{<\/span>\r\n  I2C_start<span style=\"color: #66cc66;\">(<\/span>OLED_ADDR<span style=\"color: #66cc66;\">)<\/span>;                  \r\n  I2C_write<span style=\"color: #66cc66;\">(<\/span>OLED_DAT_MODE<span style=\"color: #66cc66;\">)<\/span>;               \r\n  char ch = pgm_read_byte<span style=\"color: #66cc66;\">(<\/span>p<span style=\"color: #66cc66;\">)<\/span>;             \r\n  <span style=\"color: #b1b100;\">while<\/span> <span style=\"color: #66cc66;\">(<\/span>ch <span style=\"color: #66cc66;\">!<\/span>= <span style=\"color: #cc66cc;\">0<\/span><span style=\"color: #66cc66;\">)<\/span><span style=\"color: #66cc66;\">{<\/span>OLED_printC<span style=\"color: #66cc66;\">(<\/span>ch<span style=\"color: #66cc66;\">)<\/span>;ch = pgm_read_byte<span style=\"color: #66cc66;\">(<\/span>++p<span style=\"color: #66cc66;\">)<\/span>;<span style=\"color: #66cc66;\">}<\/span>\r\n  I2C_stop<span style=\"color: #66cc66;\">(<\/span><span style=\"color: #66cc66;\">)<\/span>;       \r\n<span style=\"color: #66cc66;\">}<\/span>\r\n\u00a0\r\n<span style=\"color: #0066cc;\">void<\/span> OLED_num<span style=\"color: #66cc66;\">(<\/span>byte num<span style=\"color: #66cc66;\">)<\/span><span style=\"color: #66cc66;\">{<\/span>\r\n  I2C_start<span style=\"color: #66cc66;\">(<\/span>OLED_ADDR<span style=\"color: #66cc66;\">)<\/span>;                 \r\n  I2C_write<span style=\"color: #66cc66;\">(<\/span>OLED_DAT_MODE<span style=\"color: #66cc66;\">)<\/span>;    \r\n  OLED_printC<span style=\"color: #66cc66;\">(<\/span>num+<span style=\"color: #cc66cc;\">48<\/span><span style=\"color: #66cc66;\">)<\/span>; \r\n  I2C_stop<span style=\"color: #66cc66;\">(<\/span><span style=\"color: #66cc66;\">)<\/span>;    \r\n  <span style=\"color: #66cc66;\">}<\/span>\r\n\u00a0\r\n<span style=\"color: #0066cc;\">void<\/span> OLED_cursor<span style=\"color: #66cc66;\">(<\/span>uint8_t xpos, uint8_t ypos<span style=\"color: #66cc66;\">)<\/span> <span style=\"color: #66cc66;\">{<\/span>\r\n  I2C_start<span style=\"color: #66cc66;\">(<\/span>OLED_ADDR<span style=\"color: #66cc66;\">)<\/span>;                   \r\n  I2C_write<span style=\"color: #66cc66;\">(<\/span>OLED_CMD_MODE<span style=\"color: #66cc66;\">)<\/span>;               \r\n  I2C_write<span style=\"color: #66cc66;\">(<\/span>xpos <span style=\"color: #66cc66;\">&amp;<\/span> 0x0F<span style=\"color: #66cc66;\">)<\/span>;                 \r\n  I2C_write<span style=\"color: #66cc66;\">(<\/span>0x10 <span style=\"color: #66cc66;\">|<\/span> <span style=\"color: #66cc66;\">(<\/span>xpos <span style=\"color: #66cc66;\">&gt;&gt;<\/span> <span style=\"color: #cc66cc;\">4<\/span><span style=\"color: #66cc66;\">)<\/span><span style=\"color: #66cc66;\">)<\/span>;     \r\n  I2C_write<span style=\"color: #66cc66;\">(<\/span>0xB0 <span style=\"color: #66cc66;\">|<\/span> <span style=\"color: #66cc66;\">(<\/span>ypos <span style=\"color: #66cc66;\">&amp;<\/span> 0x07<span style=\"color: #66cc66;\">)<\/span><span style=\"color: #66cc66;\">)<\/span>;    \r\n  I2C_stop<span style=\"color: #66cc66;\">(<\/span><span style=\"color: #66cc66;\">)<\/span>;                           \r\n<span style=\"color: #66cc66;\">}<\/span>\r\n\u00a0\r\n<span style=\"color: #0066cc;\">void<\/span> OLED_brig<span style=\"color: #66cc66;\">(<\/span>byte br<span style=\"color: #66cc66;\">)<\/span><span style=\"color: #66cc66;\">{<\/span>\r\n  I2C_start<span style=\"color: #66cc66;\">(<\/span>OLED_ADDR<span style=\"color: #66cc66;\">)<\/span>;                   \r\n  I2C_write<span style=\"color: #66cc66;\">(<\/span>OLED_CMD_MODE<span style=\"color: #66cc66;\">)<\/span>;               \r\n  I2C_write<span style=\"color: #66cc66;\">(<\/span>0x81<span style=\"color: #66cc66;\">)<\/span>;                 \r\n  I2C_write<span style=\"color: #66cc66;\">(<\/span>br<span style=\"color: #66cc66;\">)<\/span>;        \r\n  I2C_stop<span style=\"color: #66cc66;\">(<\/span><span style=\"color: #66cc66;\">)<\/span>;\r\n  <span style=\"color: #66cc66;\">}<\/span>\r\n\u00a0\r\n<span style=\"color: #0066cc;\">void<\/span> OLED_inver<span style=\"color: #66cc66;\">(<\/span>bool inv<span style=\"color: #66cc66;\">)<\/span><span style=\"color: #66cc66;\">{<\/span>\r\n  <span style=\"color: #0066cc;\">int<\/span> inv_data;\r\n  <span style=\"color: #b1b100;\">if<\/span><span style=\"color: #66cc66;\">(<\/span>inv==<span style=\"color: #cc66cc;\">0<\/span><span style=\"color: #66cc66;\">)<\/span> inv_data=0xA6; <span style=\"color: #b1b100;\">else<\/span> inv_data=0xA7;\r\n  I2C_start<span style=\"color: #66cc66;\">(<\/span>OLED_ADDR<span style=\"color: #66cc66;\">)<\/span>;                   \r\n  I2C_write<span style=\"color: #66cc66;\">(<\/span>OLED_CMD_MODE<span style=\"color: #66cc66;\">)<\/span>;               \r\n  I2C_write<span style=\"color: #66cc66;\">(<\/span>inv_data<span style=\"color: #66cc66;\">)<\/span>;                        \r\n  I2C_stop<span style=\"color: #66cc66;\">(<\/span><span style=\"color: #66cc66;\">)<\/span>;\r\n  <span style=\"color: #66cc66;\">}<\/span>  \r\n\u00a0\r\n<span style=\"color: #0066cc;\">void<\/span> OLED_clear<span style=\"color: #66cc66;\">(<\/span><span style=\"color: #0066cc;\">void<\/span><span style=\"color: #66cc66;\">)<\/span> <span style=\"color: #66cc66;\">{<\/span>\r\n  <span style=\"color: #b1b100;\">for<\/span> <span style=\"color: #66cc66;\">(<\/span>uint8_t i = <span style=\"color: #cc66cc;\">0<\/span>; i <span style=\"color: #66cc66;\">&lt;<\/span> <span style=\"color: #cc66cc;\">8<\/span>; i++<span style=\"color: #66cc66;\">)<\/span><span style=\"color: #66cc66;\">{<\/span>\r\n    OLED_cursor<span style=\"color: #66cc66;\">(<\/span><span style=\"color: #cc66cc;\">0<\/span>, i<span style=\"color: #66cc66;\">)<\/span>;\r\n    I2C_start<span style=\"color: #66cc66;\">(<\/span>OLED_ADDR<span style=\"color: #66cc66;\">)<\/span>;                  \r\n    I2C_write<span style=\"color: #66cc66;\">(<\/span>OLED_DAT_MODE<span style=\"color: #66cc66;\">)<\/span>;              \r\n    <span style=\"color: #b1b100;\">for<\/span><span style=\"color: #66cc66;\">(<\/span>uint8_t i=<span style=\"color: #cc66cc;\">128<\/span>; i; i--<span style=\"color: #66cc66;\">)<\/span> I2C_write<span style=\"color: #66cc66;\">(<\/span>0x00<span style=\"color: #66cc66;\">)<\/span>;\r\n    I2C_stop<span style=\"color: #66cc66;\">(<\/span><span style=\"color: #66cc66;\">)<\/span>;                            \r\n  <span style=\"color: #66cc66;\">}<\/span>\r\n  <span style=\"color: #66cc66;\">}<\/span><\/pre>\n<blockquote><p>\u0421\u043a\u0435\u0442\u0447 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 1216 \u0431\u0430\u0439\u0442 (29%) \u043f\u0430\u043c\u044f\u0442\u0438 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430. \u0412\u0441\u0435\u0433\u043e \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e 4096 \u0431\u0430\u0439\u0442.<br \/>\n\u0413\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u044b\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 2 \u0431\u0430\u0439\u0442 (0%) \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u043f\u0430\u043c\u044f\u0442\u0438, \u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044f 254 \u0431\u0430\u0439\u0442 \u0434\u043b\u044f \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0445 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445. \u041c\u0430\u043a\u0441\u0438\u043c\u0443\u043c: 256 \u0431\u0430\u0439\u0442.<\/p><\/blockquote>\n<hr \/>\n<p style=\"text-align: center;\">\u00a0<strong>0.91&#8242; SSD1306 128&#215;32 OLED I2C<\/strong><\/p>\n<p><a href=\"http:\/\/rcl-radio.ru\/wp-content\/uploads\/2022\/10\/\u0421\u043d\u0438\u043c\u043e\u043a-\u044d\u043a\u0440\u0430\u043d\u0430-\u043e\u0442-2022-10-07-18-09-53.png\" class=\"highslide-image\" onclick=\"return hs.expand(this);\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-129449\" src=\"http:\/\/rcl-radio.ru\/wp-content\/uploads\/2022\/10\/\u0421\u043d\u0438\u043c\u043e\u043a-\u044d\u043a\u0440\u0430\u043d\u0430-\u043e\u0442-2022-10-07-18-09-53.png\" alt=\"\" width=\"317\" height=\"107\" srcset=\"http:\/\/rcl-radio.ru\/wp-content\/uploads\/2022\/10\/\u0421\u043d\u0438\u043c\u043e\u043a-\u044d\u043a\u0440\u0430\u043d\u0430-\u043e\u0442-2022-10-07-18-09-53.png 317w, http:\/\/rcl-radio.ru\/wp-content\/uploads\/2022\/10\/\u0421\u043d\u0438\u043c\u043e\u043a-\u044d\u043a\u0440\u0430\u043d\u0430-\u043e\u0442-2022-10-07-18-09-53-200x68.png 200w\" sizes=\"auto, (max-width: 317px) 100vw, 317px\" \/><\/a><\/p>\n<p><a href=\"http:\/\/rcl-radio.ru\/wp-content\/uploads\/2022\/10\/\u0421\u043d\u0438\u043c\u043e\u043a-\u044d\u043a\u0440\u0430\u043d\u0430-\u043e\u0442-2022-10-07-18-11-49.png\" class=\"highslide-image\" onclick=\"return hs.expand(this);\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-129450\" src=\"http:\/\/rcl-radio.ru\/wp-content\/uploads\/2022\/10\/\u0421\u043d\u0438\u043c\u043e\u043a-\u044d\u043a\u0440\u0430\u043d\u0430-\u043e\u0442-2022-10-07-18-11-49.png\" alt=\"\" width=\"523\" height=\"250\" srcset=\"http:\/\/rcl-radio.ru\/wp-content\/uploads\/2022\/10\/\u0421\u043d\u0438\u043c\u043e\u043a-\u044d\u043a\u0440\u0430\u043d\u0430-\u043e\u0442-2022-10-07-18-11-49.png 523w, http:\/\/rcl-radio.ru\/wp-content\/uploads\/2022\/10\/\u0421\u043d\u0438\u043c\u043e\u043a-\u044d\u043a\u0440\u0430\u043d\u0430-\u043e\u0442-2022-10-07-18-11-49-500x239.png 500w, http:\/\/rcl-radio.ru\/wp-content\/uploads\/2022\/10\/\u0421\u043d\u0438\u043c\u043e\u043a-\u044d\u043a\u0440\u0430\u043d\u0430-\u043e\u0442-2022-10-07-18-11-49-200x96.png 200w\" sizes=\"auto, (max-width: 523px) 100vw, 523px\" \/><\/a><\/p>\n<pre class=\"actionscript\" style=\"font-family: monospace; font-size: 10px;\"><span style=\"color: #808080; font-style: italic;\">#include &lt;avr\/io.h&gt;<\/span>\r\n<span style=\"color: #808080; font-style: italic;\">#include &lt;util\/delay.h&gt;<\/span>\r\n\u00a0\r\n<span style=\"color: #808080; font-style: italic;\">\/\/ Project Files (Github):  https:\/\/github.com\/wagiminator\/ATtiny13-TinyOLEDdemo<\/span>\r\n<span style=\"color: #808080; font-style: italic;\">\/\/ License: http:\/\/creativecommons.org\/licenses\/by-sa\/3.0\/<\/span>\r\n\u00a0\r\n<span style=\"color: #808080; font-style: italic;\">#define I2C_SDA         PB3                   <\/span>\r\n<span style=\"color: #808080; font-style: italic;\">#define I2C_SCL         PB4                  <\/span>\r\n\u00a0\r\n<span style=\"color: #808080; font-style: italic;\">#define I2C_SDA_HIGH()  DDRB &amp;= ~(1&lt;&lt;I2C_SDA) <\/span>\r\n<span style=\"color: #808080; font-style: italic;\">#define I2C_SDA_LOW()   DDRB |=  (1&lt;&lt;I2C_SDA) <\/span>\r\n<span style=\"color: #808080; font-style: italic;\">#define I2C_SCL_HIGH()  DDRB &amp;= ~(1&lt;&lt;I2C_SCL) <\/span>\r\n<span style=\"color: #808080; font-style: italic;\">#define I2C_SCL_LOW()   DDRB |=  (1&lt;&lt;I2C_SCL) <\/span>\r\n\u00a0\r\nconst char Message1<span style=\"color: #66cc66;\">[<\/span><span style=\"color: #66cc66;\">]<\/span> PROGMEM = <span style=\"color: #ff0000;\">\"RCL-RADIO.RU\"<\/span>;\r\nconst char Message2<span style=\"color: #66cc66;\">[<\/span><span style=\"color: #66cc66;\">]<\/span> PROGMEM = <span style=\"color: #ff0000;\">\"OLED 0.91 \/ 128x32\"<\/span>;\r\nconst char Message3<span style=\"color: #66cc66;\">[<\/span><span style=\"color: #66cc66;\">]<\/span> PROGMEM = <span style=\"color: #ff0000;\">\"SSD1306\"<\/span>;\r\nconst char Message4<span style=\"color: #66cc66;\">[<\/span><span style=\"color: #66cc66;\">]<\/span> PROGMEM = <span style=\"color: #ff0000;\">\"Line 4\"<\/span>;\r\n<span style=\"color: #0066cc;\">int<\/span> n;\r\n\u00a0\r\n<span style=\"color: #0066cc;\">int<\/span> main<span style=\"color: #66cc66;\">(<\/span><span style=\"color: #0066cc;\">void<\/span><span style=\"color: #66cc66;\">)<\/span> <span style=\"color: #66cc66;\">{<\/span>\r\n  OLED_init<span style=\"color: #66cc66;\">(<\/span><span style=\"color: #66cc66;\">)<\/span>;\r\n  OLED_brig<span style=\"color: #66cc66;\">(<\/span><span style=\"color: #cc66cc;\">150<\/span><span style=\"color: #66cc66;\">)<\/span>;<span style=\"color: #808080; font-style: italic;\">\/\/ 0...255<\/span>\r\n  OLED_inver<span style=\"color: #66cc66;\">(<\/span><span style=\"color: #cc66cc;\">0<\/span><span style=\"color: #66cc66;\">)<\/span>; <span style=\"color: #808080; font-style: italic;\">\/\/ invers                           <\/span>\r\n  OLED_clear<span style=\"color: #66cc66;\">(<\/span><span style=\"color: #66cc66;\">)<\/span>; \r\n\u00a0\r\n  <span style=\"color: #b1b100;\">while<\/span><span style=\"color: #66cc66;\">(<\/span><span style=\"color: #cc66cc;\">1<\/span><span style=\"color: #66cc66;\">)<\/span> <span style=\"color: #66cc66;\">{<\/span> \r\nOLED_cursor<span style=\"color: #66cc66;\">(<\/span><span style=\"color: #cc66cc;\">0<\/span>, <span style=\"color: #cc66cc;\">0<\/span><span style=\"color: #66cc66;\">)<\/span>;                \r\n    OLED_printP<span style=\"color: #66cc66;\">(<\/span>Message1<span style=\"color: #66cc66;\">)<\/span>; \r\n    OLED_cursor<span style=\"color: #66cc66;\">(<\/span><span style=\"color: #cc66cc;\">0<\/span>, <span style=\"color: #cc66cc;\">1<\/span><span style=\"color: #66cc66;\">)<\/span>;                \r\n    OLED_printP<span style=\"color: #66cc66;\">(<\/span>Message2<span style=\"color: #66cc66;\">)<\/span>;  \r\n    OLED_cursor<span style=\"color: #66cc66;\">(<\/span><span style=\"color: #cc66cc;\">0<\/span>, <span style=\"color: #cc66cc;\">2<\/span><span style=\"color: #66cc66;\">)<\/span>;                \r\n    OLED_printP<span style=\"color: #66cc66;\">(<\/span>Message3<span style=\"color: #66cc66;\">)<\/span>;               \r\n    OLED_cursor<span style=\"color: #66cc66;\">(<\/span><span style=\"color: #cc66cc;\">0<\/span>, <span style=\"color: #cc66cc;\">3<\/span><span style=\"color: #66cc66;\">)<\/span>;\r\n    OLED_printP<span style=\"color: #66cc66;\">(<\/span>Message4<span style=\"color: #66cc66;\">)<\/span>;                   \r\n        n++;\r\n    <span style=\"color: #b1b100;\">if<\/span><span style=\"color: #66cc66;\">(<\/span>n<span style=\"color: #66cc66;\">&gt;<\/span><span style=\"color: #cc66cc;\">50<\/span><span style=\"color: #66cc66;\">)<\/span><span style=\"color: #66cc66;\">{<\/span>n=<span style=\"color: #cc66cc;\">0<\/span>;<span style=\"color: #66cc66;\">}<\/span>\r\n    OLED_cursor<span style=\"color: #66cc66;\">(<\/span><span style=\"color: #cc66cc;\">70<\/span>, <span style=\"color: #cc66cc;\">3<\/span><span style=\"color: #66cc66;\">)<\/span>;\r\n    OLED_num<span style=\"color: #66cc66;\">(<\/span>n<span style=\"color: #66cc66;\">\/<\/span><span style=\"color: #cc66cc;\">10<\/span><span style=\"color: #66cc66;\">)<\/span>;OLED_num<span style=\"color: #66cc66;\">(<\/span>n<span style=\"color: #66cc66;\">%<\/span>10<span style=\"color: #66cc66;\">)<\/span>;\r\n    _delay_ms<span style=\"color: #66cc66;\">(<\/span><span style=\"color: #cc66cc;\">100<\/span><span style=\"color: #66cc66;\">)<\/span>;                      \r\n<span style=\"color: #66cc66;\">}<\/span><span style=\"color: #66cc66;\">}<\/span>\r\n\u00a0\r\n<span style=\"color: #808080; font-style: italic;\">\/\/\/\/\/ I2C \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/<\/span>\r\n<span style=\"color: #0066cc;\">void<\/span> I2C_init<span style=\"color: #66cc66;\">(<\/span><span style=\"color: #0066cc;\">void<\/span><span style=\"color: #66cc66;\">)<\/span> <span style=\"color: #66cc66;\">{<\/span>DDRB  <span style=\"color: #66cc66;\">&amp;<\/span>= ~<span style=\"color: #66cc66;\">(<\/span><span style=\"color: #66cc66;\">(<\/span><span style=\"color: #cc66cc;\">1<\/span><span style=\"color: #66cc66;\">&lt;&lt;<\/span>I2C_SDA<span style=\"color: #66cc66;\">)<\/span><span style=\"color: #66cc66;\">|<\/span><span style=\"color: #66cc66;\">(<\/span><span style=\"color: #cc66cc;\">1<\/span><span style=\"color: #66cc66;\">&lt;&lt;<\/span>I2C_SCL<span style=\"color: #66cc66;\">)<\/span><span style=\"color: #66cc66;\">)<\/span>; PORTB <span style=\"color: #66cc66;\">&amp;<\/span>= ~<span style=\"color: #66cc66;\">(<\/span><span style=\"color: #66cc66;\">(<\/span><span style=\"color: #cc66cc;\">1<\/span><span style=\"color: #66cc66;\">&lt;&lt;<\/span>I2C_SDA<span style=\"color: #66cc66;\">)<\/span><span style=\"color: #66cc66;\">|<\/span><span style=\"color: #66cc66;\">(<\/span><span style=\"color: #cc66cc;\">1<\/span><span style=\"color: #66cc66;\">&lt;&lt;<\/span>I2C_SCL<span style=\"color: #66cc66;\">)<\/span><span style=\"color: #66cc66;\">)<\/span>;<span style=\"color: #66cc66;\">}<\/span>\r\n<span style=\"color: #0066cc;\">void<\/span> I2C_write<span style=\"color: #66cc66;\">(<\/span>uint8_t <span style=\"color: #0066cc;\">data<\/span><span style=\"color: #66cc66;\">)<\/span> <span style=\"color: #66cc66;\">{<\/span>\r\n  <span style=\"color: #b1b100;\">for<\/span><span style=\"color: #66cc66;\">(<\/span>uint8_t i = <span style=\"color: #cc66cc;\">8<\/span>; i; i--<span style=\"color: #66cc66;\">)<\/span> <span style=\"color: #66cc66;\">{<\/span>I2C_SDA_LOW<span style=\"color: #66cc66;\">(<\/span><span style=\"color: #66cc66;\">)<\/span>;                        \r\n    <span style=\"color: #b1b100;\">if<\/span> <span style=\"color: #66cc66;\">(<\/span><span style=\"color: #0066cc;\">data<\/span> <span style=\"color: #66cc66;\">&amp;<\/span> 0x80<span style=\"color: #66cc66;\">)<\/span> I2C_SDA_HIGH<span style=\"color: #66cc66;\">(<\/span><span style=\"color: #66cc66;\">)<\/span>;I2C_SCL_HIGH<span style=\"color: #66cc66;\">(<\/span><span style=\"color: #66cc66;\">)<\/span>;data<span style=\"color: #66cc66;\">&lt;&lt;<\/span>=<span style=\"color: #cc66cc;\">1<\/span>;I2C_SCL_LOW<span style=\"color: #66cc66;\">(<\/span><span style=\"color: #66cc66;\">)<\/span>;<span style=\"color: #66cc66;\">}<\/span>\r\n  I2C_SDA_HIGH<span style=\"color: #66cc66;\">(<\/span><span style=\"color: #66cc66;\">)<\/span>;I2C_SCL_HIGH<span style=\"color: #66cc66;\">(<\/span><span style=\"color: #66cc66;\">)<\/span>;asm<span style=\"color: #66cc66;\">(<\/span><span style=\"color: #ff0000;\">\"nop\"<\/span><span style=\"color: #66cc66;\">)<\/span>;I2C_SCL_LOW<span style=\"color: #66cc66;\">(<\/span><span style=\"color: #66cc66;\">)<\/span>;                         \r\n<span style=\"color: #66cc66;\">}<\/span>\r\n<span style=\"color: #0066cc;\">void<\/span> I2C_start<span style=\"color: #66cc66;\">(<\/span>uint8_t addr<span style=\"color: #66cc66;\">)<\/span> <span style=\"color: #66cc66;\">{<\/span>I2C_SDA_LOW<span style=\"color: #66cc66;\">(<\/span><span style=\"color: #66cc66;\">)<\/span>;I2C_SCL_LOW<span style=\"color: #66cc66;\">(<\/span><span style=\"color: #66cc66;\">)<\/span>;I2C_write<span style=\"color: #66cc66;\">(<\/span>addr<span style=\"color: #66cc66;\">)<\/span>;<span style=\"color: #66cc66;\">}<\/span>\r\n<span style=\"color: #0066cc;\">void<\/span> I2C_stop<span style=\"color: #66cc66;\">(<\/span><span style=\"color: #0066cc;\">void<\/span><span style=\"color: #66cc66;\">)<\/span> <span style=\"color: #66cc66;\">{<\/span>I2C_SDA_LOW<span style=\"color: #66cc66;\">(<\/span><span style=\"color: #66cc66;\">)<\/span>;I2C_SCL_HIGH<span style=\"color: #66cc66;\">(<\/span><span style=\"color: #66cc66;\">)<\/span>;I2C_SDA_HIGH<span style=\"color: #66cc66;\">(<\/span><span style=\"color: #66cc66;\">)<\/span>;<span style=\"color: #66cc66;\">}<\/span>\r\n\u00a0\r\n<span style=\"color: #808080; font-style: italic;\">\/\/\/\/\/ OLED \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/<\/span>\r\n<span style=\"color: #808080; font-style: italic;\">#define OLED_ADDR       0x78                  <\/span>\r\n<span style=\"color: #808080; font-style: italic;\">#define OLED_CMD_MODE   0x00                  <\/span>\r\n<span style=\"color: #808080; font-style: italic;\">#define OLED_DAT_MODE   0x40                  <\/span>\r\n<span style=\"color: #808080; font-style: italic;\">#define OLED_INIT_LEN   12                 <\/span>\r\n\u00a0\r\nconst uint8_t OLED_INIT_CMD<span style=\"color: #66cc66;\">[<\/span><span style=\"color: #66cc66;\">]<\/span> PROGMEM = <span style=\"color: #66cc66;\">{<\/span>0xA8,0x1F,0x22,0x00,0x03,0x20,0x00,0xDA,0x02,0x8D,0x14,0xAF,0xA1,0xC8<span style=\"color: #66cc66;\">}<\/span>;\r\nconst uint8_t OLED_FONT<span style=\"color: #66cc66;\">[<\/span><span style=\"color: #66cc66;\">]<\/span> PROGMEM = <span style=\"color: #66cc66;\">{<\/span>\r\n   0x00, 0x00, 0x00, 0x00, 0x00, <span style=\"color: #808080; font-style: italic;\">\/\/ sp<\/span>\r\n   0x00, 0x00, 0x5F, 0x00, 0x00, <span style=\"color: #808080; font-style: italic;\">\/\/ !<\/span>\r\n   0x00, 0x03, 0x00, 0x03, 0x00, <span style=\"color: #808080; font-style: italic;\">\/\/ \"<\/span>\r\n   0x14, 0x3E, 0x14, 0x3E, 0x14, <span style=\"color: #808080; font-style: italic;\">\/\/ #<\/span>\r\n   0x24, 0x2A, 0x7F, 0x2A, 0x12, <span style=\"color: #808080; font-style: italic;\">\/\/ $<\/span>\r\n   0x43, 0x33, 0x08, 0x66, 0x61, <span style=\"color: #808080; font-style: italic;\">\/\/ %<\/span>\r\n   0x36, 0x49, 0x55, 0x22, 0x50, <span style=\"color: #808080; font-style: italic;\">\/\/ &amp;<\/span>\r\n   0x00, 0x05, 0x03, 0x00, 0x00, <span style=\"color: #808080; font-style: italic;\">\/\/ '<\/span>\r\n   0x00, 0x1C, 0x22, 0x41, 0x00, <span style=\"color: #808080; font-style: italic;\">\/\/ (<\/span>\r\n   0x00, 0x41, 0x22, 0x1C, 0x00, <span style=\"color: #808080; font-style: italic;\">\/\/ )<\/span>\r\n   0x14, 0x08, 0x3E, 0x08, 0x14, <span style=\"color: #808080; font-style: italic;\">\/\/ *<\/span>\r\n   0x08, 0x08, 0x3E, 0x08, 0x08, <span style=\"color: #808080; font-style: italic;\">\/\/ +<\/span>\r\n   0x00, 0x50, 0x30, 0x00, 0x00, <span style=\"color: #808080; font-style: italic;\">\/\/ ,<\/span>\r\n   0x08, 0x08, 0x08, 0x08, 0x08, <span style=\"color: #808080; font-style: italic;\">\/\/ -<\/span>\r\n   0x00, 0x60, 0x60, 0x00, 0x00, <span style=\"color: #808080; font-style: italic;\">\/\/ .<\/span>\r\n   0x20, 0x10, 0x08, 0x04, 0x02, <span style=\"color: #808080; font-style: italic;\">\/\/ \/<\/span>\r\n   0x3E, 0x51, 0x49, 0x45, 0x3E, <span style=\"color: #808080; font-style: italic;\">\/\/ 0<\/span>\r\n   0x00, 0x04, 0x02, 0x7F, 0x00, <span style=\"color: #808080; font-style: italic;\">\/\/ 1<\/span>\r\n   0x42, 0x61, 0x51, 0x49, 0x46, <span style=\"color: #808080; font-style: italic;\">\/\/ 2<\/span>\r\n   0x22, 0x41, 0x49, 0x49, 0x36, <span style=\"color: #808080; font-style: italic;\">\/\/ 3<\/span>\r\n   0x18, 0x14, 0x12, 0x7F, 0x10, <span style=\"color: #808080; font-style: italic;\">\/\/ 4<\/span>\r\n   0x27, 0x45, 0x45, 0x45, 0x39, <span style=\"color: #808080; font-style: italic;\">\/\/ 5<\/span>\r\n   0x3E, 0x49, 0x49, 0x49, 0x32, <span style=\"color: #808080; font-style: italic;\">\/\/ 6<\/span>\r\n   0x01, 0x01, 0x71, 0x09, 0x07, <span style=\"color: #808080; font-style: italic;\">\/\/ 7<\/span>\r\n   0x36, 0x49, 0x49, 0x49, 0x36, <span style=\"color: #808080; font-style: italic;\">\/\/ 8<\/span>\r\n   0x26, 0x49, 0x49, 0x49, 0x3E, <span style=\"color: #808080; font-style: italic;\">\/\/ 9<\/span>\r\n   0x00, 0x36, 0x36, 0x00, 0x00, <span style=\"color: #808080; font-style: italic;\">\/\/ :<\/span>\r\n   0x00, 0x56, 0x36, 0x00, 0x00, <span style=\"color: #808080; font-style: italic;\">\/\/ ;<\/span>\r\n   0x08, 0x14, 0x22, 0x41, 0x00, <span style=\"color: #808080; font-style: italic;\">\/\/ &lt;<\/span>\r\n   0x14, 0x14, 0x14, 0x14, 0x14, <span style=\"color: #808080; font-style: italic;\">\/\/ =<\/span>\r\n   0x00, 0x41, 0x22, 0x14, 0x08, <span style=\"color: #808080; font-style: italic;\">\/\/ &gt;<\/span>\r\n   0x02, 0x01, 0x51, 0x09, 0x06, <span style=\"color: #808080; font-style: italic;\">\/\/ ?<\/span>\r\n   0x3E, 0x41, 0x59, 0x55, 0x5E, <span style=\"color: #808080; font-style: italic;\">\/\/ @<\/span>\r\n   0x7E, 0x09, 0x09, 0x09, 0x7E, <span style=\"color: #808080; font-style: italic;\">\/\/ A<\/span>\r\n   0x7F, 0x49, 0x49, 0x49, 0x36, <span style=\"color: #808080; font-style: italic;\">\/\/ B<\/span>\r\n   0x3E, 0x41, 0x41, 0x41, 0x22, <span style=\"color: #808080; font-style: italic;\">\/\/ C<\/span>\r\n   0x7F, 0x41, 0x41, 0x41, 0x3E, <span style=\"color: #808080; font-style: italic;\">\/\/ D<\/span>\r\n   0x7F, 0x49, 0x49, 0x49, 0x41, <span style=\"color: #808080; font-style: italic;\">\/\/ E<\/span>\r\n   0x7F, 0x09, 0x09, 0x09, 0x01, <span style=\"color: #808080; font-style: italic;\">\/\/ F<\/span>\r\n   0x3E, 0x41, 0x41, 0x49, 0x3A, <span style=\"color: #808080; font-style: italic;\">\/\/ G<\/span>\r\n   0x7F, 0x08, 0x08, 0x08, 0x7F, <span style=\"color: #808080; font-style: italic;\">\/\/ H<\/span>\r\n   0x00, 0x41, 0x7F, 0x41, 0x00, <span style=\"color: #808080; font-style: italic;\">\/\/ I<\/span>\r\n   0x30, 0x40, 0x40, 0x40, 0x3F, <span style=\"color: #808080; font-style: italic;\">\/\/ J<\/span>\r\n   0x7F, 0x08, 0x14, 0x22, 0x41, <span style=\"color: #808080; font-style: italic;\">\/\/ K<\/span>\r\n   0x7F, 0x40, 0x40, 0x40, 0x40, <span style=\"color: #808080; font-style: italic;\">\/\/ L<\/span>\r\n   0x7F, 0x02, 0x0C, 0x02, 0x7F, <span style=\"color: #808080; font-style: italic;\">\/\/ M<\/span>\r\n   0x7F, 0x02, 0x04, 0x08, 0x7F, <span style=\"color: #808080; font-style: italic;\">\/\/ N<\/span>\r\n   0x3E, 0x41, 0x41, 0x41, 0x3E, <span style=\"color: #808080; font-style: italic;\">\/\/ O<\/span>\r\n   0x7F, 0x09, 0x09, 0x09, 0x06, <span style=\"color: #808080; font-style: italic;\">\/\/ P<\/span>\r\n   0x1E, 0x21, 0x21, 0x21, 0x5E, <span style=\"color: #808080; font-style: italic;\">\/\/ Q<\/span>\r\n   0x7F, 0x09, 0x09, 0x09, 0x76, <span style=\"color: #808080; font-style: italic;\">\/\/ R<\/span>\r\n   0x26, 0x49, 0x49, 0x49, 0x32, <span style=\"color: #808080; font-style: italic;\">\/\/ S<\/span>\r\n   0x01, 0x01, 0x7F, 0x01, 0x01, <span style=\"color: #808080; font-style: italic;\">\/\/ T<\/span>\r\n   0x3F, 0x40, 0x40, 0x40, 0x3F, <span style=\"color: #808080; font-style: italic;\">\/\/ U<\/span>\r\n   0x1F, 0x20, 0x40, 0x20, 0x1F, <span style=\"color: #808080; font-style: italic;\">\/\/ V<\/span>\r\n   0x7F, 0x20, 0x10, 0x20, 0x7F, <span style=\"color: #808080; font-style: italic;\">\/\/ W<\/span>\r\n   0x41, 0x22, 0x1C, 0x22, 0x41, <span style=\"color: #808080; font-style: italic;\">\/\/ X<\/span>\r\n   0x07, 0x08, 0x70, 0x08, 0x07, <span style=\"color: #808080; font-style: italic;\">\/\/ Y<\/span>\r\n   0x61, 0x51, 0x49, 0x45, 0x43, <span style=\"color: #808080; font-style: italic;\">\/\/ Z<\/span>\r\n   0x00, 0x7F, 0x41, 0x00, 0x00, <span style=\"color: #808080; font-style: italic;\">\/\/ [<\/span>\r\n   0x02, 0x04, 0x08, 0x10, 0x20, <span style=\"color: #808080; font-style: italic;\">\/\/ \"\/\"<\/span>\r\n   0x00, 0x00, 0x41, 0x7F, 0x00, <span style=\"color: #808080; font-style: italic;\">\/\/ ]<\/span>\r\n   0x04, 0x02, 0x01, 0x02, 0x04, <span style=\"color: #808080; font-style: italic;\">\/\/ ^<\/span>\r\n   0x40, 0x40, 0x40, 0x40, 0x40, <span style=\"color: #808080; font-style: italic;\">\/\/ _<\/span>\r\n   0x00, 0x01, 0x02, 0x04, 0x00, <span style=\"color: #808080; font-style: italic;\">\/\/ `<\/span>\r\n   0x20, 0x54, 0x54, 0x54, 0x78, <span style=\"color: #808080; font-style: italic;\">\/\/ a<\/span>\r\n   0x7F, 0x44, 0x44, 0x44, 0x38, <span style=\"color: #808080; font-style: italic;\">\/\/ b<\/span>\r\n   0x38, 0x44, 0x44, 0x44, 0x44, <span style=\"color: #808080; font-style: italic;\">\/\/ c<\/span>\r\n   0x38, 0x44, 0x44, 0x44, 0x7F, <span style=\"color: #808080; font-style: italic;\">\/\/ d<\/span>\r\n   0x38, 0x54, 0x54, 0x54, 0x18, <span style=\"color: #808080; font-style: italic;\">\/\/ e<\/span>\r\n   0x04, 0x04, 0x7E, 0x05, 0x05, <span style=\"color: #808080; font-style: italic;\">\/\/ f<\/span>\r\n   0x08, 0x54, 0x54, 0x54, 0x3C, <span style=\"color: #808080; font-style: italic;\">\/\/ g<\/span>\r\n   0x7F, 0x08, 0x04, 0x04, 0x78, <span style=\"color: #808080; font-style: italic;\">\/\/ h<\/span>\r\n   0x00, 0x44, 0x7D, 0x40, 0x00, <span style=\"color: #808080; font-style: italic;\">\/\/ i<\/span>\r\n   0x20, 0x40, 0x44, 0x3D, 0x00, <span style=\"color: #808080; font-style: italic;\">\/\/ j<\/span>\r\n   0x7F, 0x10, 0x28, 0x44, 0x00, <span style=\"color: #808080; font-style: italic;\">\/\/ k<\/span>\r\n   0x00, 0x41, 0x7F, 0x40, 0x00, <span style=\"color: #808080; font-style: italic;\">\/\/ l<\/span>\r\n   0x7C, 0x04, 0x78, 0x04, 0x78, <span style=\"color: #808080; font-style: italic;\">\/\/ m<\/span>\r\n   0x7C, 0x08, 0x04, 0x04, 0x78, <span style=\"color: #808080; font-style: italic;\">\/\/ n<\/span>\r\n   0x38, 0x44, 0x44, 0x44, 0x38, <span style=\"color: #808080; font-style: italic;\">\/\/ o<\/span>\r\n   0x7C, 0x14, 0x14, 0x14, 0x08, <span style=\"color: #808080; font-style: italic;\">\/\/ p<\/span>\r\n   0x08, 0x14, 0x14, 0x14, 0x7C, <span style=\"color: #808080; font-style: italic;\">\/\/ q<\/span>\r\n   0x00, 0x7C, 0x08, 0x04, 0x04, <span style=\"color: #808080; font-style: italic;\">\/\/ r<\/span>\r\n   0x48, 0x54, 0x54, 0x54, 0x20, <span style=\"color: #808080; font-style: italic;\">\/\/ s<\/span>\r\n   0x04, 0x04, 0x3F, 0x44, 0x44, <span style=\"color: #808080; font-style: italic;\">\/\/ t<\/span>\r\n   0x3C, 0x40, 0x40, 0x20, 0x7C, <span style=\"color: #808080; font-style: italic;\">\/\/ u<\/span>\r\n   0x1C, 0x20, 0x40, 0x20, 0x1C, <span style=\"color: #808080; font-style: italic;\">\/\/ v<\/span>\r\n   0x3C, 0x40, 0x30, 0x40, 0x3C, <span style=\"color: #808080; font-style: italic;\">\/\/ w<\/span>\r\n   0x44, 0x28, 0x10, 0x28, 0x44, <span style=\"color: #808080; font-style: italic;\">\/\/ x<\/span>\r\n   0x0C, 0x50, 0x50, 0x50, 0x3C, <span style=\"color: #808080; font-style: italic;\">\/\/ y<\/span>\r\n   0x44, 0x64, 0x54, 0x4C, 0x44, <span style=\"color: #808080; font-style: italic;\">\/\/ z<\/span>\r\n   0x00, 0x08, 0x36, 0x41, 0x41, <span style=\"color: #808080; font-style: italic;\">\/\/ {<\/span>\r\n   0x00, 0x00, 0x7F, 0x00, 0x00, <span style=\"color: #808080; font-style: italic;\">\/\/ |<\/span>\r\n   0x41, 0x41, 0x36, 0x08, 0x00, <span style=\"color: #808080; font-style: italic;\">\/\/ }<\/span>\r\n   0x02, 0x01, 0x02, 0x04, 0x02, <span style=\"color: #808080; font-style: italic;\">\/\/ ~<\/span>\r\n<span style=\"color: #66cc66;\">}<\/span>;\r\n\u00a0\r\n<span style=\"color: #0066cc;\">void<\/span> OLED_init<span style=\"color: #66cc66;\">(<\/span><span style=\"color: #0066cc;\">void<\/span><span style=\"color: #66cc66;\">)<\/span> <span style=\"color: #66cc66;\">{<\/span>\r\n  I2C_init<span style=\"color: #66cc66;\">(<\/span><span style=\"color: #66cc66;\">)<\/span>;                             \r\n  I2C_start<span style=\"color: #66cc66;\">(<\/span>OLED_ADDR<span style=\"color: #66cc66;\">)<\/span>;                   \r\n  I2C_write<span style=\"color: #66cc66;\">(<\/span>OLED_CMD_MODE<span style=\"color: #66cc66;\">)<\/span>;               \r\n  <span style=\"color: #b1b100;\">for<\/span> <span style=\"color: #66cc66;\">(<\/span>uint8_t i = <span style=\"color: #cc66cc;\">0<\/span>; i <span style=\"color: #66cc66;\">&lt;<\/span> OLED_INIT_LEN; i++<span style=\"color: #66cc66;\">)<\/span> I2C_write<span style=\"color: #66cc66;\">(<\/span>pgm_read_byte<span style=\"color: #66cc66;\">(<\/span><span style=\"color: #66cc66;\">&amp;<\/span>OLED_INIT_CMD<span style=\"color: #66cc66;\">[<\/span>i<span style=\"color: #66cc66;\">]<\/span><span style=\"color: #66cc66;\">)<\/span><span style=\"color: #66cc66;\">)<\/span>; \r\n  I2C_stop<span style=\"color: #66cc66;\">(<\/span><span style=\"color: #66cc66;\">)<\/span>;                            \r\n<span style=\"color: #66cc66;\">}<\/span>\r\n\u00a0\r\n<span style=\"color: #0066cc;\">void<\/span> OLED_printC<span style=\"color: #66cc66;\">(<\/span>char ch<span style=\"color: #66cc66;\">)<\/span> <span style=\"color: #66cc66;\">{<\/span>\r\n  uint16_t offset = ch - <span style=\"color: #cc66cc;\">32<\/span>;             \r\n  offset += offset <span style=\"color: #66cc66;\">&lt;&lt;<\/span> <span style=\"color: #cc66cc;\">2<\/span>;                \r\n  I2C_write<span style=\"color: #66cc66;\">(<\/span>0x00<span style=\"color: #66cc66;\">)<\/span>;        \r\n  <span style=\"color: #b1b100;\">for<\/span><span style=\"color: #66cc66;\">(<\/span>uint8_t i=<span style=\"color: #cc66cc;\">5<\/span>; i; i--<span style=\"color: #66cc66;\">)<\/span> I2C_write<span style=\"color: #66cc66;\">(<\/span>pgm_read_byte<span style=\"color: #66cc66;\">(<\/span><span style=\"color: #66cc66;\">&amp;<\/span>OLED_FONT<span style=\"color: #66cc66;\">[<\/span>offset++<span style=\"color: #66cc66;\">]<\/span><span style=\"color: #66cc66;\">)<\/span><span style=\"color: #66cc66;\">)<\/span>; \r\n<span style=\"color: #66cc66;\">}<\/span>\r\n\u00a0\r\n<span style=\"color: #0066cc;\">void<\/span> OLED_printP<span style=\"color: #66cc66;\">(<\/span>const char<span style=\"color: #66cc66;\">*<\/span> p<span style=\"color: #66cc66;\">)<\/span> <span style=\"color: #66cc66;\">{<\/span>\r\n  I2C_start<span style=\"color: #66cc66;\">(<\/span>OLED_ADDR<span style=\"color: #66cc66;\">)<\/span>;                   \r\n  I2C_write<span style=\"color: #66cc66;\">(<\/span>OLED_DAT_MODE<span style=\"color: #66cc66;\">)<\/span>;               \r\n  char ch = pgm_read_byte<span style=\"color: #66cc66;\">(<\/span>p<span style=\"color: #66cc66;\">)<\/span>;            \r\n  <span style=\"color: #b1b100;\">while<\/span> <span style=\"color: #66cc66;\">(<\/span>ch <span style=\"color: #66cc66;\">!<\/span>= <span style=\"color: #cc66cc;\">0<\/span><span style=\"color: #66cc66;\">)<\/span><span style=\"color: #66cc66;\">{<\/span>OLED_printC<span style=\"color: #66cc66;\">(<\/span>ch<span style=\"color: #66cc66;\">)<\/span>;ch = pgm_read_byte<span style=\"color: #66cc66;\">(<\/span>++p<span style=\"color: #66cc66;\">)<\/span>;<span style=\"color: #66cc66;\">}<\/span>\r\n  I2C_stop<span style=\"color: #66cc66;\">(<\/span><span style=\"color: #66cc66;\">)<\/span>;                   \r\n<span style=\"color: #66cc66;\">}<\/span>\r\n\u00a0\r\n<span style=\"color: #0066cc;\">void<\/span> OLED_cursor<span style=\"color: #66cc66;\">(<\/span>uint8_t xpos, uint8_t ypos<span style=\"color: #66cc66;\">)<\/span> <span style=\"color: #66cc66;\">{<\/span>\r\n  I2C_start<span style=\"color: #66cc66;\">(<\/span>OLED_ADDR<span style=\"color: #66cc66;\">)<\/span>;                   \r\n  I2C_write<span style=\"color: #66cc66;\">(<\/span>OLED_CMD_MODE<span style=\"color: #66cc66;\">)<\/span>;               \r\n  I2C_write<span style=\"color: #66cc66;\">(<\/span>xpos <span style=\"color: #66cc66;\">&amp;<\/span> 0x0F<span style=\"color: #66cc66;\">)<\/span>;                 \r\n  I2C_write<span style=\"color: #66cc66;\">(<\/span>0x10 <span style=\"color: #66cc66;\">|<\/span> <span style=\"color: #66cc66;\">(<\/span>xpos <span style=\"color: #66cc66;\">&gt;&gt;<\/span> <span style=\"color: #cc66cc;\">4<\/span><span style=\"color: #66cc66;\">)<\/span><span style=\"color: #66cc66;\">)<\/span>;     \r\n  I2C_write<span style=\"color: #66cc66;\">(<\/span>0xB0 <span style=\"color: #66cc66;\">|<\/span> <span style=\"color: #66cc66;\">(<\/span>ypos <span style=\"color: #66cc66;\">&amp;<\/span> 0x07<span style=\"color: #66cc66;\">)<\/span><span style=\"color: #66cc66;\">)<\/span>;    \r\n  I2C_stop<span style=\"color: #66cc66;\">(<\/span><span style=\"color: #66cc66;\">)<\/span>;                           \r\n<span style=\"color: #66cc66;\">}<\/span>\r\n\u00a0\r\n<span style=\"color: #0066cc;\">void<\/span> OLED_clear<span style=\"color: #66cc66;\">(<\/span><span style=\"color: #0066cc;\">void<\/span><span style=\"color: #66cc66;\">)<\/span> <span style=\"color: #66cc66;\">{<\/span>\r\n  OLED_cursor<span style=\"color: #66cc66;\">(<\/span><span style=\"color: #cc66cc;\">0<\/span>, <span style=\"color: #cc66cc;\">0<\/span><span style=\"color: #66cc66;\">)<\/span>;                      \r\n  I2C_start<span style=\"color: #66cc66;\">(<\/span>OLED_ADDR<span style=\"color: #66cc66;\">)<\/span>;                   \r\n  I2C_write<span style=\"color: #66cc66;\">(<\/span>OLED_DAT_MODE<span style=\"color: #66cc66;\">)<\/span>;              \r\n  <span style=\"color: #b1b100;\">for<\/span><span style=\"color: #66cc66;\">(<\/span>uint16_t i=<span style=\"color: #cc66cc;\">512<\/span>; i; i--<span style=\"color: #66cc66;\">)<\/span> I2C_write<span style=\"color: #66cc66;\">(<\/span>0x00<span style=\"color: #66cc66;\">)<\/span>; \r\n  I2C_stop<span style=\"color: #66cc66;\">(<\/span><span style=\"color: #66cc66;\">)<\/span>;  \r\n<span style=\"color: #66cc66;\">}<\/span>\r\n\u00a0\r\n<span style=\"color: #0066cc;\">void<\/span> OLED_num<span style=\"color: #66cc66;\">(<\/span>byte num<span style=\"color: #66cc66;\">)<\/span><span style=\"color: #66cc66;\">{<\/span>\r\n  I2C_start<span style=\"color: #66cc66;\">(<\/span>OLED_ADDR<span style=\"color: #66cc66;\">)<\/span>;                 \r\n  I2C_write<span style=\"color: #66cc66;\">(<\/span>OLED_DAT_MODE<span style=\"color: #66cc66;\">)<\/span>;    \r\n  OLED_printC<span style=\"color: #66cc66;\">(<\/span>num+<span style=\"color: #cc66cc;\">48<\/span><span style=\"color: #66cc66;\">)<\/span>; \r\n  I2C_stop<span style=\"color: #66cc66;\">(<\/span><span style=\"color: #66cc66;\">)<\/span>;    \r\n  <span style=\"color: #66cc66;\">}<\/span>\r\n\u00a0\r\n<span style=\"color: #0066cc;\">void<\/span> OLED_brig<span style=\"color: #66cc66;\">(<\/span>byte br<span style=\"color: #66cc66;\">)<\/span><span style=\"color: #66cc66;\">{<\/span>\r\n  I2C_start<span style=\"color: #66cc66;\">(<\/span>OLED_ADDR<span style=\"color: #66cc66;\">)<\/span>;                   \r\n  I2C_write<span style=\"color: #66cc66;\">(<\/span>OLED_CMD_MODE<span style=\"color: #66cc66;\">)<\/span>;               \r\n  I2C_write<span style=\"color: #66cc66;\">(<\/span>0x81<span style=\"color: #66cc66;\">)<\/span>;                 \r\n  I2C_write<span style=\"color: #66cc66;\">(<\/span>br<span style=\"color: #66cc66;\">)<\/span>;        \r\n  I2C_stop<span style=\"color: #66cc66;\">(<\/span><span style=\"color: #66cc66;\">)<\/span>;\r\n  <span style=\"color: #66cc66;\">}<\/span>\r\n\u00a0\r\n<span style=\"color: #0066cc;\">void<\/span> OLED_inver<span style=\"color: #66cc66;\">(<\/span>bool inv<span style=\"color: #66cc66;\">)<\/span><span style=\"color: #66cc66;\">{<\/span>\r\n  <span style=\"color: #0066cc;\">int<\/span> inv_data;\r\n  <span style=\"color: #b1b100;\">if<\/span><span style=\"color: #66cc66;\">(<\/span>inv==<span style=\"color: #cc66cc;\">0<\/span><span style=\"color: #66cc66;\">)<\/span> inv_data=0xA6; <span style=\"color: #b1b100;\">else<\/span> inv_data=0xA7;\r\n  I2C_start<span style=\"color: #66cc66;\">(<\/span>OLED_ADDR<span style=\"color: #66cc66;\">)<\/span>;                   \r\n  I2C_write<span style=\"color: #66cc66;\">(<\/span>OLED_CMD_MODE<span style=\"color: #66cc66;\">)<\/span>;               \r\n  I2C_write<span style=\"color: #66cc66;\">(<\/span>inv_data<span style=\"color: #66cc66;\">)<\/span>;                        \r\n  I2C_stop<span style=\"color: #66cc66;\">(<\/span><span style=\"color: #66cc66;\">)<\/span>;\r\n  <span style=\"color: #66cc66;\">}<\/span> \r\n<\/pre>\n<p>\u0424\u043e\u0440\u0443\u043c &#8212; <a href=\"http:\/\/forum.rcl-radio.ru\/viewtopic.php?id=518\">http:\/\/forum.rcl-radio.ru\/viewtopic.php?id=518<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u0414\u0438\u0441\u043f\u043b\u0435\u0439 0.96\u2032 I2C 128X64 OLED \u043d\u0430 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0435 SSD1306 \u0438\u043c\u0435\u0435\u0442 \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u0435 128\u044564 \u043f\u0438\u043a\u0441\u0435\u043b \u0438 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u043a \u043c\u0438\u043a\u0440\u043e\u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0443 \u043f\u043e \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0443 I2C. \u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0434\u0438\u0441\u043f\u043b\u0435\u044f SSD1306: \u0422\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u044f \u0434\u0438\u0441\u043f\u043b\u0435\u044f: OLED \u0420\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0434\u0438\u0441\u043f\u043b\u0435\u044f: 128 \u043d\u0430 64 \u0442\u043e\u0447\u043a\u0438 \u0414\u0438\u0430\u0433\u043e\u043d\u0430\u043b\u044c \u0434\u0438\u0441\u043f\u043b\u0435\u044f: 0,96 \u0434\u044e\u0439\u043c\u0430 \u0423\u0433\u043e\u043b \u043e\u0431\u0437\u043e\u0440\u0430: 160\u00b0 \u041d\u0430\u043f\u0440\u044f\u0436\u0435\u043d\u0438\u0435 \u043f\u0438\u0442\u0430\u043d\u0438\u044f: 2.8 \u0412 ~ 5.5 \u0412 \u041c\u043e\u0449\u043d\u043e\u0441\u0442\u044c: 0,08 \u0412\u0442 \u0413\u0430\u0431\u0430\u0440\u0438\u0442\u044b: 27.3 \u043c\u043c \u0445 27.8 \u043c\u043c \u0445 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":129446,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[239,17,21],"tags":[],"class_list":["post-129443","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-arduino","category-17","category-21"],"views":3478,"_links":{"self":[{"href":"http:\/\/rcl-radio.ru\/index.php?rest_route=\/wp\/v2\/posts\/129443","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/rcl-radio.ru\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/rcl-radio.ru\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/rcl-radio.ru\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/rcl-radio.ru\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=129443"}],"version-history":[{"count":4,"href":"http:\/\/rcl-radio.ru\/index.php?rest_route=\/wp\/v2\/posts\/129443\/revisions"}],"predecessor-version":[{"id":129588,"href":"http:\/\/rcl-radio.ru\/index.php?rest_route=\/wp\/v2\/posts\/129443\/revisions\/129588"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/rcl-radio.ru\/index.php?rest_route=\/wp\/v2\/media\/129446"}],"wp:attachment":[{"href":"http:\/\/rcl-radio.ru\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=129443"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/rcl-radio.ru\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=129443"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/rcl-radio.ru\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=129443"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}