{"id":130545,"date":"2023-05-03T08:13:27","date_gmt":"2023-05-03T02:13:27","guid":{"rendered":"http:\/\/rcl-radio.ru\/?p=130545"},"modified":"2024-06-05T15:51:40","modified_gmt":"2024-06-05T09:51:40","slug":"mcp23017-16-%d0%b1%d0%b8%d1%82%d0%bd%d1%8b%d0%b9-%d1%80%d0%b0%d1%81%d1%88%d0%b8%d1%80%d0%b8%d1%82%d0%b5%d0%bb%d1%8c-%d0%bf%d0%be%d1%80%d1%82%d0%be%d0%b2-i-o","status":"publish","type":"post","link":"http:\/\/rcl-radio.ru\/?p=130545","title":{"rendered":"MCP23017 &#8212;  \u0440\u0430\u0441\u0448\u0438\u0440\u0438\u0442\u0435\u043b\u044c \u043f\u043e\u0440\u0442\u043e\u0432 GPIO (Arduino)"},"content":{"rendered":"<p>MCP23017 &#8212;\u00a0 \u0440\u0430\u0441\u0448\u0438\u0440\u0438\u0442\u0435\u043b\u044c \u043f\u043e\u0440\u0442\u043e\u0432 GPIO, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0434\u043e 16 \u0446\u0438\u0444\u0440\u043e\u0432\u044b\u043c\u0438 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430\u043c\u0438 \u0447\u0435\u0440\u0435\u0437 \u043e\u0434\u0438\u043d \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 I2C. \u041e\u043d \u0438\u043c\u0435\u0435\u0442 \u0434\u0432\u0430 \u043f\u043e\u0440\u0442\u0430 \u043f\u043e 8 GPIO \u043a\u0430\u0436\u0434\u044b\u0439, \u0447\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c 16 \u0446\u0438\u0444\u0440\u043e\u0432\u044b\u0445 \u0441\u0438\u0433\u043d\u0430\u043b\u043e\u0432 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0432\u0441\u0435\u0433\u043e \u0434\u0432\u0443\u0445 \u0432\u044b\u0432\u043e\u0434\u043e\u0432 \u043c\u0438\u043a\u0440\u043e\u0441\u0445\u0435\u043c\u044b.<\/p>\n<p>\u041e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b MCP23017:<\/p>\n<p>&#8212; \u041d\u0430\u043f\u0440\u044f\u0436\u0435\u043d\u0438\u0435 \u043f\u0438\u0442\u0430\u043d\u0438\u044f: 1,8 \u0412 &#8212; 5,5 \u0412<br \/>\n&#8212; \u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u043e\u0440\u0442\u043e\u0432 \u0432\u0432\u043e\u0434\u0430-\u0432\u044b\u0432\u043e\u0434\u0430: 16 (2 \u043f\u043e\u0440\u0442\u0430 \u043f\u043e 8 GPIO)<br \/>\n&#8212; \u0418\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0441\u0432\u044f\u0437\u0438: I2C<br \/>\n&#8212; \u041c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u0442\u043e\u043a, \u0432\u044b\u0434\u0430\u0432\u0430\u0435\u043c\u044b\u0439 \u043d\u0430 \u043a\u0430\u0436\u0434\u044b\u0439 \u043f\u043e\u0440\u0442: 25 \u043c\u0410<br \/>\n&#8212; \u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u043e\u0439 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u043a\u0430\u0436\u0434\u043e\u0433\u043e GPIO \u043d\u0430 \u0432\u0445\u043e\u0434 \u0438\u043b\u0438 \u0432\u044b\u0445\u043e\u0434, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043d\u0430 \u043f\u043e\u0434\u0442\u044f\u0433\u0438\u0432\u0430\u043d\u0438\u0435 \u043a \u043f\u0438\u0442\u0430\u043d\u0438\u044e \u0438\u043b\u0438 \u0437\u0435\u043c\u043b\u0435.<\/p>\n<p>MCP23017 \u043c\u043e\u0436\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0432\u043e \u043c\u043d\u043e\u0433\u0438\u0445 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f\u0445, \u0432\u043a\u043b\u044e\u0447\u0430\u044f \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0441\u0432\u0435\u0442\u043e\u0434\u0438\u043e\u0434\u0430\u043c\u0438, \u043a\u043d\u043e\u043f\u043a\u0430\u043c\u0438, \u0434\u0438\u0441\u043f\u043b\u0435\u044f\u043c\u0438, \u0440\u0435\u043b\u0435, \u0441\u0435\u043d\u0441\u043e\u0440\u0430\u043c\u0438 \u0438 \u0442.\u0434.<\/p>\n<p>\u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, MCP23017 \u0438\u043c\u0435\u0435\u0442 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u0439, \u0447\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043c\u0438\u043a\u0440\u043e\u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0443 \u043d\u0435 \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u043e \u043e\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0442\u044c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043f\u043e\u0440\u0442\u043e\u0432, \u0430 \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u0443\u0432\u0435\u0434\u043e\u043c\u043b\u0435\u043d\u0438\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0445 \u043f\u043e\u0440\u0442\u043e\u0432.<\/p>\n<p>MCP23017 \u0438\u043c\u0435\u0435\u0442 \u0434\u0432\u0430 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 (IODIRA \u0438 IODIRB), \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0442 \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u043a\u0430\u0436\u0434\u044b\u0439 \u043f\u043e\u0440\u0442 \u043d\u0430 \u0432\u0445\u043e\u0434 \u0438\u043b\u0438 \u0432\u044b\u0445\u043e\u0434. \u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u0435\u0441\u0442\u044c \u0434\u0432\u0430 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430 \u043f\u043e\u0434\u0442\u044f\u0433\u0438\u0432\u0430\u044e\u0449\u0438\u0445 \u0440\u0435\u0437\u0438\u0441\u0442\u043e\u0440\u043e\u0432 (GPPUA \u0438 GPPUB), \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0442 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u043f\u043e\u0434\u0442\u044f\u0433\u0438\u0432\u0430\u044e\u0449\u0438\u0435 \u0440\u0435\u0437\u0438\u0441\u0442\u043e\u0440\u044b \u043a \u043a\u0430\u0436\u0434\u043e\u043c\u0443 \u043f\u043e\u0440\u0442\u0443, \u0447\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u043e\u043b\u0435\u0437\u043d\u043e, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 \u043a\u043d\u043e\u043f\u043e\u043a.<\/p>\n<p>MCP23017 \u0442\u0430\u043a\u0436\u0435 \u0438\u043c\u0435\u0435\u0442 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u044b \u0434\u043b\u044f \u0447\u0442\u0435\u043d\u0438\u044f \u0438 \u0437\u0430\u043f\u0438\u0441\u0438 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043f\u043e\u0440\u0442\u0430 (GPIOA \u0438 GPIOB), \u0430 \u0442\u0430\u043a\u0436\u0435 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u044b \u0434\u043b\u044f \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435\u043c \u043f\u043e\u0440\u0442\u043e\u0432 (OLATA \u0438 OLATB), \u0447\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043c\u0438\u043a\u0440\u043e\u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0443 \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0442\u044c \u0438\u043b\u0438 \u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043f\u043e\u0440\u0442\u043e\u0432 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e I2C \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430.<\/p>\n<div id=\"marketWidget\"><\/div>\n<p>\u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, MCP23017 \u0438\u043c\u0435\u0435\u0442 \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u0443\u044e \u0437\u0430\u0449\u0438\u0442\u0443 \u043e\u0442 \u043a\u043e\u0440\u043e\u0442\u043a\u043e\u0433\u043e \u0437\u0430\u043c\u044b\u043a\u0430\u043d\u0438\u044f \u0438 \u043f\u0435\u0440\u0435\u0433\u0440\u0443\u0437\u043a\u0438, \u0447\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0442\u044c \u043d\u0430\u0434\u0435\u0436\u043d\u043e\u0441\u0442\u044c \u0438 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u044c \u0441\u0438\u0441\u0442\u0435\u043c\u044b.<\/p>\n<p>\u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 MCP23017 \u043c\u043e\u0436\u043d\u043e \u0440\u0430\u0441\u0448\u0438\u0440\u0438\u0442\u044c, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043c\u0438\u043a\u0440\u043e\u0441\u0445\u0435\u043c \u0432\u043c\u0435\u0441\u0442\u0435. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e MCP23017 \u043a \u043e\u0434\u043d\u043e\u043c\u0443 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0443 I2C \u0438 \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0434\u043e 128 GPIO (8 \u043c\u0438\u043a\u0440\u043e\u0441\u0445\u0435\u043c \u043f\u043e 16 GPIO). \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u043a\u0430\u0436\u0434\u0430\u044f \u043c\u0438\u043a\u0440\u043e\u0441\u0445\u0435\u043c\u0430 \u0434\u043e\u043b\u0436\u043d\u0430 \u0438\u043c\u0435\u0442\u044c \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0439 \u0430\u0434\u0440\u0435\u0441, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0445 \u043f\u0438\u043d\u043e\u0432 \u043d\u0430 \u043c\u0438\u043a\u0440\u043e\u0441\u0445\u0435\u043c\u0435.<\/p>\n<p>MCP23017 \u043c\u043e\u0436\u0435\u0442 \u0438\u043c\u0435\u0442\u044c \u0434\u043e 8 \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0445 \u0430\u0434\u0440\u0435\u0441\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043f\u0438\u043d\u043e\u0432 A0, A1 \u0438 A2 \u043d\u0430 \u043c\u0438\u043a\u0440\u043e\u0441\u0445\u0435\u043c\u0435. \u0412 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u044b \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0435 \u0430\u0434\u0440\u0435\u0441\u0430 \u0434\u043b\u044f MCP23017:<\/p>\n<p><strong>A2 A1 A0\u00a0 \u00a0 \u00a0 \u0410\u0434\u0440\u0435\u0441<\/strong><br \/>\n0\u00a0 \u00a00\u00a0 \u00a00\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 0x20<br \/>\n0\u00a0 \u00a00\u00a0 \u00a01\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 0x21<br \/>\n0\u00a0 \u00a01\u00a0 \u00a00\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 0x22<br \/>\n0\u00a0 \u00a01\u00a0 \u00a01\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 0x23<br \/>\n1\u00a0 \u00a00\u00a0 \u00a00\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 0x24<br \/>\n1\u00a0 \u00a00\u00a0 \u00a01\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 0x25<br \/>\n1\u00a0 \u00a01\u00a0 \u00a00\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 0x26<br \/>\n1\u00a0 \u00a01\u00a0 \u00a01\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 0x27<\/p>\n<p>\u0412 \u0446\u0435\u043b\u043e\u043c, MCP23017 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0443\u0434\u043e\u0431\u043d\u044b\u043c \u0438 \u043c\u043e\u0449\u043d\u044b\u043c \u0440\u0430\u0441\u0448\u0438\u0440\u0438\u0442\u0435\u043b\u0435\u043c \u043f\u043e\u0440\u0442\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d \u0432\u043e \u043c\u043d\u043e\u0433\u0438\u0445 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u0430\u0445 \u0434\u043b\u044f \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0446\u0438\u0444\u0440\u043e\u0432\u044b\u043c\u0438 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430\u043c\u0438.<\/p>\n<p>\u0420\u0430\u0441\u0448\u0438\u0440\u0438\u0442\u0435\u043b\u044c \u043f\u043e\u0440\u0442\u043e\u0432 MCP23017 \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0438\u043e\u0431\u0440\u0435\u0441\u0442\u0438 \u0432 \u0432\u0438\u0434\u0435 \u0433\u043e\u0442\u043e\u0432\u043e\u0433\u043e \u043c\u043e\u0434\u0443\u043b\u044f cjmcu-2317:<\/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\/2023\/05\/\u0421\u043d\u0438\u043c\u043e\u043a-\u044d\u043a\u0440\u0430\u043d\u0430_2023-05-02_13-35-23.png\" class=\"highslide-image\" onclick=\"return hs.expand(this);\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-130547\" src=\"http:\/\/rcl-radio.ru\/wp-content\/uploads\/2023\/05\/\u0421\u043d\u0438\u043c\u043e\u043a-\u044d\u043a\u0440\u0430\u043d\u0430_2023-05-02_13-35-23.png\" alt=\"\" width=\"257\" height=\"315\" srcset=\"http:\/\/rcl-radio.ru\/wp-content\/uploads\/2023\/05\/\u0421\u043d\u0438\u043c\u043e\u043a-\u044d\u043a\u0440\u0430\u043d\u0430_2023-05-02_13-35-23.png 359w, http:\/\/rcl-radio.ru\/wp-content\/uploads\/2023\/05\/\u0421\u043d\u0438\u043c\u043e\u043a-\u044d\u043a\u0440\u0430\u043d\u0430_2023-05-02_13-35-23-200x245.png 200w\" sizes=\"auto, (max-width: 257px) 100vw, 257px\" \/><\/a><\/td>\n<td style=\"width: 50%;\"><a href=\"http:\/\/rcl-radio.ru\/wp-content\/uploads\/2023\/05\/\u0421\u043d\u0438\u043c\u043e\u043a-\u044d\u043a\u0440\u0430\u043d\u0430_2023-05-02_13-40-23.png\" class=\"highslide-image\" onclick=\"return hs.expand(this);\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-130548\" src=\"http:\/\/rcl-radio.ru\/wp-content\/uploads\/2023\/05\/\u0421\u043d\u0438\u043c\u043e\u043a-\u044d\u043a\u0440\u0430\u043d\u0430_2023-05-02_13-40-23.png\" alt=\"\" width=\"352\" height=\"424\" srcset=\"http:\/\/rcl-radio.ru\/wp-content\/uploads\/2023\/05\/\u0421\u043d\u0438\u043c\u043e\u043a-\u044d\u043a\u0440\u0430\u043d\u0430_2023-05-02_13-40-23.png 352w, http:\/\/rcl-radio.ru\/wp-content\/uploads\/2023\/05\/\u0421\u043d\u0438\u043c\u043e\u043a-\u044d\u043a\u0440\u0430\u043d\u0430_2023-05-02_13-40-23-200x241.png 200w\" sizes=\"auto, (max-width: 352px) 100vw, 352px\" \/><\/a><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>&nbsp;<\/p>\n<p>\u0414\u043b\u044f \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043c\u043e\u0434\u0443\u043b\u044f \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0437\u0430\u043c\u043a\u043d\u0443\u0442\u044c \u043a\u043e\u043d\u0442\u0430\u043a\u0442\u044b \u04100 \u04101 \u04102 \u043d\u0430 VCC \u0438\u043b\u0438 GND \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u043d\u0443\u0436\u043d\u043e\u0433\u043e \u0412\u0430\u043c I2C \u0430\u0434\u0440\u0435\u0441\u0430.<\/p>\n<p>\u041f\u0440\u0438 \u0437\u0430\u043c\u044b\u043a\u0430\u043d\u0438\u0438 \u043a\u043e\u043d\u0442\u0430\u043a\u0442\u043e\u0432 \u04100 \u04101 \u04102 \u043d\u0430 GND \u0438 \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0432 \u0441\u043a\u0430\u043d\u0435\u0440 I2C \u043f\u043e\u0440\u0442\u043e\u0432 (\u0441\u043a\u0435\u0442\u0447 \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u0432 \u043f\u0440\u0438\u043c\u0435\u0440\u0430\u0445 Arduino IDE), \u0432 \u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0435 \u043c\u043e\u0436\u043d\u043e \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u044b\u0439 I2C \u0430\u0434\u0440\u0435\u0441:<\/p>\n<p><a href=\"http:\/\/rcl-radio.ru\/wp-content\/uploads\/2023\/05\/\u0421\u043d\u0438\u043c\u043e\u043a-\u044d\u043a\u0440\u0430\u043d\u0430_2023-05-02_13-45-57.png\" class=\"highslide-image\" onclick=\"return hs.expand(this);\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-130549\" src=\"http:\/\/rcl-radio.ru\/wp-content\/uploads\/2023\/05\/\u0421\u043d\u0438\u043c\u043e\u043a-\u044d\u043a\u0440\u0430\u043d\u0430_2023-05-02_13-45-57.png\" alt=\"\" width=\"337\" height=\"306\" srcset=\"http:\/\/rcl-radio.ru\/wp-content\/uploads\/2023\/05\/\u0421\u043d\u0438\u043c\u043e\u043a-\u044d\u043a\u0440\u0430\u043d\u0430_2023-05-02_13-45-57.png 337w, http:\/\/rcl-radio.ru\/wp-content\/uploads\/2023\/05\/\u0421\u043d\u0438\u043c\u043e\u043a-\u044d\u043a\u0440\u0430\u043d\u0430_2023-05-02_13-45-57-200x182.png 200w\" sizes=\"auto, (max-width: 337px) 100vw, 337px\" \/><\/a><\/p>\n<p>\u0414\u043b\u044f \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0440\u0430\u0441\u0448\u0438\u0440\u0438\u0442\u0435\u043b\u044f \u043f\u043e\u0440\u0442\u043e\u0432 \u043c\u043e\u0436\u043d\u043e \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u043e\u0439 &#8212; <a href=\"http:\/\/rcl-radio.ru\/wp-content\/uploads\/2023\/05\/Adafruit-MCP23017-Arduino-Library-master.zip\">Adafruit-MCP23017-Arduino-Library-master<\/a>, \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0412\u0430\u043c \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 &#8212;\u00a0<a href=\"http:\/\/rcl-radio.ru\/wp-content\/uploads\/2023\/05\/Adafruit_BusIO-master.zip\">Adafruit_BusIO-master<\/a>.<\/p>\n<p>\u041f\u0440\u0438 \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u0438 \u043a \u043f\u0438\u043d\u0430\u043c \u0440\u0430\u0441\u0448\u0438\u0440\u0438\u0442\u0435\u043b\u044f \u043f\u043e\u0440\u0442\u043e\u0432 \u0432 Arduino IDE \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435 \u0442\u0430\u0431\u043b\u0438\u0446\u0443:<\/p>\n<table style=\"width: 567px;\">\n<thead>\n<tr>\n<th style=\"width: 267px;\" align=\"center\">\u0418\u041c\u0421 MCP23017<\/th>\n<th style=\"width: 175px;\" align=\"center\">\u041c\u043e\u0434\u0443\u043b\u044c<\/th>\n<th style=\"width: 125px;\" align=\"center\">Pin Arduino IDE<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td style=\"width: 267px;\" align=\"center\">21<\/td>\n<td style=\"width: 175px;\" align=\"center\">A0<\/td>\n<td style=\"width: 125px;\" align=\"center\">0<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 267px;\" align=\"center\">22<\/td>\n<td style=\"width: 175px;\" align=\"center\">A1<\/td>\n<td style=\"width: 125px;\" align=\"center\">1<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 267px;\" align=\"center\">23<\/td>\n<td style=\"width: 175px;\" align=\"center\">A2<\/td>\n<td style=\"width: 125px;\" align=\"center\">2<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 267px;\" align=\"center\">24<\/td>\n<td style=\"width: 175px;\" align=\"center\">A3<\/td>\n<td style=\"width: 125px;\" align=\"center\">3<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 267px;\" align=\"center\">25<\/td>\n<td style=\"width: 175px;\" align=\"center\">A4<\/td>\n<td style=\"width: 125px;\" align=\"center\">4<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 267px;\" align=\"center\">26<\/td>\n<td style=\"width: 175px;\" align=\"center\">A5<\/td>\n<td style=\"width: 125px;\" align=\"center\">5<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 267px;\" align=\"center\">27<\/td>\n<td style=\"width: 175px;\" align=\"center\">A6<\/td>\n<td style=\"width: 125px;\" align=\"center\">6<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 267px;\" align=\"center\">28<\/td>\n<td style=\"width: 175px;\" align=\"center\">A7<\/td>\n<td style=\"width: 125px;\" align=\"center\">7<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 267px;\" align=\"center\">1<\/td>\n<td style=\"width: 175px;\" align=\"center\">B0<\/td>\n<td style=\"width: 125px;\" align=\"center\">8<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 267px;\" align=\"center\">2<\/td>\n<td style=\"width: 175px;\" align=\"center\">B1<\/td>\n<td style=\"width: 125px;\" align=\"center\">9<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 267px;\" align=\"center\">3<\/td>\n<td style=\"width: 175px;\" align=\"center\">B2<\/td>\n<td style=\"width: 125px;\" align=\"center\">10<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 267px;\" align=\"center\">4<\/td>\n<td style=\"width: 175px;\" align=\"center\">B3<\/td>\n<td style=\"width: 125px;\" align=\"center\">11<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 267px;\" align=\"center\">5<\/td>\n<td style=\"width: 175px;\" align=\"center\">B4<\/td>\n<td style=\"width: 125px;\" align=\"center\">12<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 267px;\" align=\"center\">6<\/td>\n<td style=\"width: 175px;\" align=\"center\">B5<\/td>\n<td style=\"width: 125px;\" align=\"center\">13<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 267px;\" align=\"center\">7<\/td>\n<td style=\"width: 175px;\" align=\"center\">B6<\/td>\n<td style=\"width: 125px;\" align=\"center\">14<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 267px;\" align=\"center\">8<\/td>\n<td style=\"width: 175px;\" align=\"center\">B7<\/td>\n<td style=\"width: 125px;\" align=\"center\">15<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><strong>\u041f\u0440\u0438\u043c\u0435\u0440\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f<\/strong><\/p>\n<ul>\n<li><strong>Blink (\u041c\u0438\u0433\u0430\u043d\u0438\u0435 \u0441\u0432\u0435\u0442\u043e\u0434\u0438\u043e\u0434\u043e\u043c)<\/strong><\/li>\n<\/ul>\n<p>\u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u0435 \u0441\u0432\u0435\u0442\u043e\u0434\u0438\u043e\u0434 \u0432 \u043f\u0438\u043d\u0443 \u04100 (\u0447\u0435\u0440\u0435\u0437 \u0440\u0435\u0437\u0438\u0441\u0442\u043e\u0440 100 \u041e\u043c). \u041f\u043e\u0441\u043b\u0435 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u0441\u043a\u0435\u0442\u0447\u0430 \u0441\u0432\u0435\u0442\u043e\u0434\u0438\u043e\u0434 \u043d\u0430\u0447\u043d\u0435\u0442 \u043c\u0438\u0433\u0430\u0442\u044c \u0441 \u043f\u0435\u0440\u0438\u043e\u0434\u043e\u043c 1 \u0441\u0435\u043a\u0443\u043d\u0434\u0430.<\/p>\n<pre><span style=\"color: #5e6d03;\">#define<\/span> <span style=\"color: #000000;\">LED_PIN<\/span> \u00a0\u00a0\u00a0<span style=\"color: #000000;\">0<\/span> <span style=\"color: #434f54;\">\/\/ LED PIN A0<\/span>\r\n\r\n<span style=\"color: #5e6d03;\">#include<\/span> <span style=\"color: #434f54;\">&lt;<\/span><b><span style=\"color: #d35400;\">Adafruit_MCP23X17<\/span><\/b><span style=\"color: #434f54;\">.<\/span><span style=\"color: #000000;\">h<\/span><span style=\"color: #434f54;\">&gt;<\/span>\r\n<b><span style=\"color: #d35400;\">Adafruit_MCP23X17<\/span><\/b> <span style=\"color: #000000;\">mcp<\/span><span style=\"color: #000000;\">;<\/span>\r\n\r\n<span style=\"color: #00979c;\">void<\/span> <span style=\"color: #5e6d03;\">setup<\/span><span style=\"color: #000000;\">(<\/span><span style=\"color: #000000;\">)<\/span> <span style=\"color: #000000;\">{<\/span>\r\n \u00a0<b><span style=\"color: #d35400;\">Serial<\/span><\/b><span style=\"color: #434f54;\">.<\/span><span style=\"color: #d35400;\">begin<\/span><span style=\"color: #000000;\">(<\/span><span style=\"color: #000000;\">9600<\/span><span style=\"color: #000000;\">)<\/span><span style=\"color: #000000;\">;<\/span>\r\n \u00a0<span style=\"color: #000000;\">mcp<\/span><span style=\"color: #434f54;\">.<\/span><span style=\"color: #d35400;\">begin_I2C<\/span><span style=\"color: #000000;\">(<\/span><span style=\"color: #000000;\">0x20<\/span><span style=\"color: #000000;\">)<\/span><span style=\"color: #000000;\">;<\/span>\r\n \u00a0<span style=\"color: #000000;\">mcp<\/span><span style=\"color: #434f54;\">.<\/span><span style=\"color: #d35400;\">pinMode<\/span><span style=\"color: #000000;\">(<\/span><span style=\"color: #000000;\">LED_PIN<\/span><span style=\"color: #434f54;\">,<\/span> <span style=\"color: #00979c;\">OUTPUT<\/span><span style=\"color: #000000;\">)<\/span><span style=\"color: #000000;\">;<\/span>\r\n<span style=\"color: #000000;\">}<\/span>\r\n\r\n<span style=\"color: #00979c;\">void<\/span> <span style=\"color: #5e6d03;\">loop<\/span><span style=\"color: #000000;\">(<\/span><span style=\"color: #000000;\">)<\/span> <span style=\"color: #000000;\">{<\/span>\r\n \u00a0<span style=\"color: #000000;\">mcp<\/span><span style=\"color: #434f54;\">.<\/span><span style=\"color: #d35400;\">digitalWrite<\/span><span style=\"color: #000000;\">(<\/span><span style=\"color: #000000;\">LED_PIN<\/span><span style=\"color: #434f54;\">,<\/span> <span style=\"color: #00979c;\">HIGH<\/span><span style=\"color: #000000;\">)<\/span><span style=\"color: #000000;\">;<\/span>\r\n \u00a0<span style=\"color: #d35400;\">delay<\/span><span style=\"color: #000000;\">(<\/span><span style=\"color: #000000;\">500<\/span><span style=\"color: #000000;\">)<\/span><span style=\"color: #000000;\">;<\/span>\r\n \u00a0<span style=\"color: #000000;\">mcp<\/span><span style=\"color: #434f54;\">.<\/span><span style=\"color: #d35400;\">digitalWrite<\/span><span style=\"color: #000000;\">(<\/span><span style=\"color: #000000;\">LED_PIN<\/span><span style=\"color: #434f54;\">,<\/span> <span style=\"color: #00979c;\">LOW<\/span><span style=\"color: #000000;\">)<\/span><span style=\"color: #000000;\">;<\/span>\r\n \u00a0<span style=\"color: #d35400;\">delay<\/span><span style=\"color: #000000;\">(<\/span><span style=\"color: #000000;\">500<\/span><span style=\"color: #000000;\">)<\/span><span style=\"color: #000000;\">;<\/span>\r\n<span style=\"color: #000000;\">}<\/span>\r\n<\/pre>\n<ul>\n<li><strong>Read\/Write GPIO<\/strong><\/li>\n<\/ul>\n<p>\u041d\u0438\u0436\u0435 \u043f\u043e\u043a\u0430\u0437\u0430\u043d \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0439 \u0441\u043a\u0435\u0442\u0447, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0438\u0440\u0443\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0443 \u0447\u0442\u0435\u043d\u0438\u044f \u0438 \u0437\u0430\u043f\u0438\u0441\u0438 GPIO \u0432\u0445\u043e\u0434\u0430\/\u0432\u044b\u0445\u043e\u0434\u0430. \u0414\u043b\u044f \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u0438 \u0440\u0430\u0431\u043e\u0442\u044b \u0441\u043a\u0435\u0442\u0447\u0430 \u0412\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0441\u0432\u0435\u0442\u043e\u0434\u0438\u043e\u0434 \u043a \u0432\u044b\u0445\u043e\u0434\u0443 \u04100 (\u0447\u0435\u0440\u0435\u0437 \u0441\u043e\u043f\u0440\u043e\u0442\u0438\u0432\u043b\u0435\u043d\u0438\u0435 100 \u041e\u043c) \u0438 \u043a\u043d\u043e\u043f\u043a\u0443 (\u043d\u0430\u0436\u0430\u0442\u0438\u0435 \u2014 \u0437\u0430\u043c\u044b\u043a\u0430\u043d\u0438\u0435 \u043d\u0430 GND) \u043a\u043e \u0432\u0445\u043e\u0434\u0443 \u04101.<\/p>\n<p>\u041f\u0440\u0438 \u043d\u0430\u0436\u0430\u0442\u0438\u0438 \u043d\u0430 \u043a\u043d\u043e\u043f\u043a\u0443 \u0441\u0432\u0435\u0442\u043e\u0434\u0438\u043e\u0434 \u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u0433\u043e\u0440\u0430\u0442\u044c\u0441\u044f \u0438 \u0433\u0430\u0441\u043d\u0443\u0442\u044c \u043f\u0440\u0438 \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u043e\u043c \u043d\u0430\u0436\u0430\u0442\u0438\u0438 \u043d\u0430 \u043a\u043d\u043e\u043f\u043a\u0443.<\/p>\n<pre><span style=\"color: #5e6d03;\">#define<\/span> <span style=\"color: #000000;\">LED_PIN<\/span> \u00a0\u00a0\u00a0<span style=\"color: #000000;\">0<\/span> <span style=\"color: #434f54;\">\/\/ LED PIN A0<\/span>\r\n<span style=\"color: #5e6d03;\">#define<\/span> <span style=\"color: #000000;\">BUTTON_PIN<\/span> <span style=\"color: #000000;\">1<\/span> <span style=\"color: #434f54;\">\/\/ BUTTON PIN A1<\/span>\r\n\r\n<span style=\"color: #5e6d03;\">#include<\/span> <span style=\"color: #434f54;\">&lt;<\/span><b><span style=\"color: #d35400;\">Adafruit_MCP23X17<\/span><\/b><span style=\"color: #434f54;\">.<\/span><span style=\"color: #000000;\">h<\/span><span style=\"color: #434f54;\">&gt;<\/span>\r\n<b><span style=\"color: #d35400;\">Adafruit_MCP23X17<\/span><\/b> <span style=\"color: #000000;\">mcp<\/span><span style=\"color: #000000;\">;<\/span>\r\n<span style=\"color: #00979c;\">bool<\/span> <span style=\"color: #000000;\">ledState<\/span> <span style=\"color: #434f54;\">=<\/span> <span style=\"color: #00979c;\">false<\/span><span style=\"color: #000000;\">;<\/span>\r\n\r\n<span style=\"color: #00979c;\">void<\/span> <span style=\"color: #5e6d03;\">setup<\/span><span style=\"color: #000000;\">(<\/span><span style=\"color: #000000;\">)<\/span> <span style=\"color: #000000;\">{<\/span>\r\n \u00a0<b><span style=\"color: #d35400;\">Serial<\/span><\/b><span style=\"color: #434f54;\">.<\/span><span style=\"color: #d35400;\">begin<\/span><span style=\"color: #000000;\">(<\/span><span style=\"color: #000000;\">9600<\/span><span style=\"color: #000000;\">)<\/span><span style=\"color: #000000;\">;<\/span>\r\n \u00a0<span style=\"color: #000000;\">mcp<\/span><span style=\"color: #434f54;\">.<\/span><span style=\"color: #d35400;\">begin_I2C<\/span><span style=\"color: #000000;\">(<\/span><span style=\"color: #000000;\">0x20<\/span><span style=\"color: #000000;\">)<\/span><span style=\"color: #000000;\">;<\/span>\r\n \u00a0<span style=\"color: #000000;\">mcp<\/span><span style=\"color: #434f54;\">.<\/span><span style=\"color: #d35400;\">pinMode<\/span><span style=\"color: #000000;\">(<\/span><span style=\"color: #000000;\">LED_PIN<\/span><span style=\"color: #434f54;\">,<\/span> <span style=\"color: #00979c;\">OUTPUT<\/span><span style=\"color: #000000;\">)<\/span><span style=\"color: #000000;\">;<\/span>\r\n \u00a0<span style=\"color: #000000;\">mcp<\/span><span style=\"color: #434f54;\">.<\/span><span style=\"color: #d35400;\">pinMode<\/span><span style=\"color: #000000;\">(<\/span><span style=\"color: #000000;\">BUTTON_PIN<\/span><span style=\"color: #434f54;\">,<\/span> <span style=\"color: #00979c;\">INPUT_PULLUP<\/span><span style=\"color: #000000;\">)<\/span><span style=\"color: #000000;\">;<\/span>\r\n<span style=\"color: #000000;\">}<\/span>\r\n\r\n<span style=\"color: #00979c;\">void<\/span> <span style=\"color: #5e6d03;\">loop<\/span><span style=\"color: #000000;\">(<\/span><span style=\"color: #000000;\">)<\/span> <span style=\"color: #000000;\">{<\/span>\r\n \u00a0<span style=\"color: #5e6d03;\">if<\/span> <span style=\"color: #000000;\">(<\/span><span style=\"color: #000000;\">mcp<\/span><span style=\"color: #434f54;\">.<\/span><span style=\"color: #d35400;\">digitalRead<\/span><span style=\"color: #000000;\">(<\/span><span style=\"color: #000000;\">BUTTON_PIN<\/span><span style=\"color: #000000;\">)<\/span> <span style=\"color: #434f54;\">==<\/span> <span style=\"color: #00979c;\">LOW<\/span><span style=\"color: #000000;\">)<\/span><span style=\"color: #000000;\">{<\/span>\r\n \u00a0\u00a0\u00a0<span style=\"color: #000000;\">ledState<\/span> <span style=\"color: #434f54;\">=<\/span> <span style=\"color: #434f54;\">!<\/span><span style=\"color: #000000;\">ledState<\/span><span style=\"color: #000000;\">;<\/span>\r\n \u00a0<span style=\"color: #000000;\">mcp<\/span><span style=\"color: #434f54;\">.<\/span><span style=\"color: #d35400;\">digitalWrite<\/span><span style=\"color: #000000;\">(<\/span><span style=\"color: #000000;\">LED_PIN<\/span><span style=\"color: #434f54;\">,<\/span> <span style=\"color: #000000;\">ledState<\/span><span style=\"color: #000000;\">)<\/span><span style=\"color: #000000;\">;<\/span>\r\n \u00a0<span style=\"color: #5e6d03;\">while<\/span> <span style=\"color: #000000;\">(<\/span><span style=\"color: #000000;\">mcp<\/span><span style=\"color: #434f54;\">.<\/span><span style=\"color: #d35400;\">digitalRead<\/span><span style=\"color: #000000;\">(<\/span><span style=\"color: #000000;\">BUTTON_PIN<\/span><span style=\"color: #000000;\">)<\/span> <span style=\"color: #434f54;\">==<\/span> <span style=\"color: #00979c;\">LOW<\/span><span style=\"color: #000000;\">)<\/span><span style=\"color: #000000;\">;<\/span> \r\n \u00a0<span style=\"color: #d35400;\">delay<\/span><span style=\"color: #000000;\">(<\/span><span style=\"color: #000000;\">200<\/span><span style=\"color: #000000;\">)<\/span><span style=\"color: #000000;\">;<\/span>\r\n \u00a0<span style=\"color: #000000;\">}<\/span>\r\n<span style=\"color: #000000;\">}<\/span>\r\n<\/pre>\n<ul>\n<li><strong>Interrupt<\/strong><\/li>\n<\/ul>\n<p>\u0412 \u0418\u041c\u0421 MCP23017 \u0438\u043c\u0435\u044e\u0442\u0441\u044f 2 \u0432\u044b\u0445\u043e\u0434\u0430 <strong>Interrupt<\/strong> (INTA\/INTB), \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043f\u043e\u0440\u0442\u0430 \u0410 \u0438 \u0412 \u0434\u043b\u044f \u0432\u044b\u0432\u043e\u0434\u0430 \u0441\u0438\u0433\u043d\u0430\u043b\u0430 \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u044f. \u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043f\u0440\u0438 \u043d\u0430\u0436\u0430\u0442\u0438\u0438 \u043a\u043d\u043e\u043f\u043a\u0443 \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0430 \u043a\u043e \u0432\u0445\u043e\u0434\u0443 \u04104, \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u0435, \u043d\u0430 \u0432\u044b\u0445\u043e\u0434\u0435 INT\u0410 \u043f\u043e\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u0438\u0433\u043d\u0430\u043b \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u044f. \u0412\u044b\u0432\u043e\u0434 INT\u0410 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d \u043a\u043e \u0432\u0445\u043e\u0434\u0443 D7 \u043f\u043b\u0430\u0442\u044b Arduino \u0434\u043b\u044f \u0441\u0447\u0438\u0442\u044b\u0432\u0430\u043d\u0438\u044f \u0441\u0438\u0433\u043d\u0430\u043b\u0430 \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u044f.<\/p>\n<p>\u041f\u0440\u0438 \u043d\u0430\u0436\u0430\u0442\u0438\u0438 \u043d\u0430 \u043a\u043d\u043e\u043f\u043a\u0443 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u0435, \u0441\u0438\u0433\u043d\u0430\u043b \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u044f \u043f\u043e\u0441\u0442\u0443\u043f\u0430\u0435\u0442 \u043d\u0430 \u0432\u0445\u043e\u0434 D7 \u0438 \u0432 \u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0435 \u043f\u043e\u0440\u0442\u0430 \u043f\u043e\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u043e \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u0438 \u0441 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435\u043c \u043d\u043e\u043c\u0435\u0440\u0430 \u043f\u0438\u043d\u0430 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0430 \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u044f.<\/p>\n<p>\u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043d\u043e\u043c\u0435\u0440\u0430 \u043f\u0438\u043d\u0430 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0430 \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u044f \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 mcp.getLastInterruptPin().<\/p>\n<p><a href=\"http:\/\/rcl-radio.ru\/wp-content\/uploads\/2023\/05\/\u0421\u043d\u0438\u043c\u043e\u043a-\u044d\u043a\u0440\u0430\u043d\u0430_2023-05-03_08-09-21.png\" class=\"highslide-image\" onclick=\"return hs.expand(this);\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-130556\" src=\"http:\/\/rcl-radio.ru\/wp-content\/uploads\/2023\/05\/\u0421\u043d\u0438\u043c\u043e\u043a-\u044d\u043a\u0440\u0430\u043d\u0430_2023-05-03_08-09-21.png\" alt=\"\" width=\"289\" height=\"312\" srcset=\"http:\/\/rcl-radio.ru\/wp-content\/uploads\/2023\/05\/\u0421\u043d\u0438\u043c\u043e\u043a-\u044d\u043a\u0440\u0430\u043d\u0430_2023-05-03_08-09-21.png 289w, http:\/\/rcl-radio.ru\/wp-content\/uploads\/2023\/05\/\u0421\u043d\u0438\u043c\u043e\u043a-\u044d\u043a\u0440\u0430\u043d\u0430_2023-05-03_08-09-21-200x216.png 200w\" sizes=\"auto, (max-width: 289px) 100vw, 289px\" \/><\/a><\/p>\n<pre><span style=\"color: #5e6d03;\">#define<\/span> <span style=\"color: #000000;\">INT_PIN<\/span> \u00a0\u00a0\u00a0<span style=\"color: #000000;\">7<\/span> <span style=\"color: #434f54;\">\/\/ \u0432\u044b\u0432\u043e\u0434 \u043c\u0438\u043a\u0440\u043e\u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430, \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u043d\u044b\u0439 \u043a INTA\/B<\/span>\r\n<span style=\"color: #5e6d03;\">#define<\/span> <span style=\"color: #000000;\">BUTTON_PIN<\/span> <span style=\"color: #000000;\">4<\/span> <span style=\"color: #434f54;\">\/\/ BUTTON PIN A4<\/span>\r\n\r\n<span style=\"color: #5e6d03;\">#include<\/span> <span style=\"color: #434f54;\">&lt;<\/span><b><span style=\"color: #d35400;\">Adafruit_MCP23X17<\/span><\/b><span style=\"color: #434f54;\">.<\/span><span style=\"color: #000000;\">h<\/span><span style=\"color: #434f54;\">&gt;<\/span>\r\n<b><span style=\"color: #d35400;\">Adafruit_MCP23X17<\/span><\/b> <span style=\"color: #000000;\">mcp<\/span><span style=\"color: #000000;\">;<\/span>\r\n<span style=\"color: #00979c;\">bool<\/span> <span style=\"color: #000000;\">ledState<\/span> <span style=\"color: #434f54;\">=<\/span> <span style=\"color: #00979c;\">false<\/span><span style=\"color: #000000;\">;<\/span>\r\n\r\n<span style=\"color: #00979c;\">void<\/span> <span style=\"color: #5e6d03;\">setup<\/span><span style=\"color: #000000;\">(<\/span><span style=\"color: #000000;\">)<\/span> <span style=\"color: #000000;\">{<\/span>\r\n \u00a0<b><span style=\"color: #d35400;\">Serial<\/span><\/b><span style=\"color: #434f54;\">.<\/span><span style=\"color: #d35400;\">begin<\/span><span style=\"color: #000000;\">(<\/span><span style=\"color: #000000;\">9600<\/span><span style=\"color: #000000;\">)<\/span><span style=\"color: #000000;\">;<\/span>\r\n \u00a0<span style=\"color: #000000;\">mcp<\/span><span style=\"color: #434f54;\">.<\/span><span style=\"color: #d35400;\">begin_I2C<\/span><span style=\"color: #000000;\">(<\/span><span style=\"color: #000000;\">0x20<\/span><span style=\"color: #000000;\">)<\/span><span style=\"color: #000000;\">;<\/span>\r\n \u00a0<span style=\"color: #d35400;\">pinMode<\/span><span style=\"color: #000000;\">(<\/span><span style=\"color: #000000;\">INT_PIN<\/span><span style=\"color: #434f54;\">,<\/span> <span style=\"color: #00979c;\">INPUT<\/span><span style=\"color: #000000;\">)<\/span><span style=\"color: #000000;\">;<\/span>\r\n \u00a0<span style=\"color: #000000;\">mcp<\/span><span style=\"color: #434f54;\">.<\/span><span style=\"color: #000000;\">setupInterrupts<\/span><span style=\"color: #000000;\">(<\/span><span style=\"color: #00979c;\">true<\/span><span style=\"color: #434f54;\">,<\/span> <span style=\"color: #00979c;\">false<\/span><span style=\"color: #434f54;\">,<\/span> <span style=\"color: #00979c;\">LOW<\/span><span style=\"color: #000000;\">)<\/span><span style=\"color: #000000;\">;<\/span>\r\n \u00a0<span style=\"color: #434f54;\">\/\/ INTA\/B \u0431\u0443\u0434\u0435\u0442 \u041d\u0418\u0417\u041a\u0418\u041c \u043f\u0440\u0438 \u043d\u0430\u0441\u0442\u0443\u043f\u043b\u0435\u043d\u0438\u0438 \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u044f<\/span>\r\n \u00a0<span style=\"color: #434f54;\">\/\/ MCP23XXX \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0440\u0435\u0436\u0438\u043c\u044b \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u044f:<\/span>\r\n \u00a0<span style=\"color: #434f54;\">\/\/ \u00a0\u00a0\u00a0* CHANGE - \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u0435 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442, \u0435\u0441\u043b\u0438 \u0432\u044b\u0432\u043e\u0434 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u0442 \u0432 \u043f\u0440\u043e\u0442\u0438\u0432\u043e\u043f\u043e\u043b\u043e\u0436\u043d\u043e\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435<\/span>\r\n \u00a0<span style=\"color: #434f54;\">\/\/ \u00a0\u00a0\u00a0* \u041d\u0418\u0417\u041a\u0418\u0419 - \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u0435 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442, \u043a\u043e\u0433\u0434\u0430 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0432\u044b\u0432\u043e\u0434\u0430 LOW<\/span>\r\n \u00a0<span style=\"color: #434f54;\">\/\/ \u00a0\u00a0\u00a0* HIGH - \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u0435 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442, \u043a\u043e\u0433\u0434\u0430 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0432\u044b\u0432\u043e\u0434\u0430 HIGH<\/span>\r\n \u00a0<span style=\"color: #000000;\">mcp<\/span><span style=\"color: #434f54;\">.<\/span><span style=\"color: #d35400;\">pinMode<\/span><span style=\"color: #000000;\">(<\/span><span style=\"color: #000000;\">BUTTON_PIN<\/span><span style=\"color: #434f54;\">,<\/span> <span style=\"color: #00979c;\">INPUT_PULLUP<\/span><span style=\"color: #000000;\">)<\/span><span style=\"color: #000000;\">;<\/span>\r\n \u00a0<span style=\"color: #000000;\">mcp<\/span><span style=\"color: #434f54;\">.<\/span><span style=\"color: #000000;\">setupInterruptPin<\/span><span style=\"color: #000000;\">(<\/span><span style=\"color: #000000;\">BUTTON_PIN<\/span><span style=\"color: #434f54;\">,<\/span> <span style=\"color: #00979c;\">LOW<\/span><span style=\"color: #000000;\">)<\/span><span style=\"color: #000000;\">;<\/span>\r\n \u00a0<span style=\"color: #434f54;\">\/\/ \u0440\u0430\u0437\u0440\u0435\u0448\u0438\u0442\u044c \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u0435 \u043d\u0430 button_pin<\/span>\r\n<span style=\"color: #000000;\">}<\/span>\r\n\r\n<span style=\"color: #00979c;\">void<\/span> <span style=\"color: #5e6d03;\">loop<\/span><span style=\"color: #000000;\">(<\/span><span style=\"color: #000000;\">)<\/span> <span style=\"color: #000000;\">{<\/span>\r\n \u00a0<span style=\"color: #5e6d03;\">if<\/span> <span style=\"color: #000000;\">(<\/span><span style=\"color: #434f54;\">!<\/span><span style=\"color: #d35400;\">digitalRead<\/span><span style=\"color: #000000;\">(<\/span><span style=\"color: #000000;\">INT_PIN<\/span><span style=\"color: #000000;\">)<\/span><span style=\"color: #000000;\">)<\/span> <span style=\"color: #000000;\">{<\/span>\r\n \u00a0\u00a0\u00a0<b><span style=\"color: #d35400;\">Serial<\/span><\/b><span style=\"color: #434f54;\">.<\/span><span style=\"color: #d35400;\">print<\/span><span style=\"color: #000000;\">(<\/span><span style=\"color: #005c5f;\">\"Interrupt detected on pin: \"<\/span><span style=\"color: #000000;\">)<\/span><span style=\"color: #000000;\">;<\/span>\r\n \u00a0\u00a0\u00a0<b><span style=\"color: #d35400;\">Serial<\/span><\/b><span style=\"color: #434f54;\">.<\/span><span style=\"color: #d35400;\">println<\/span><span style=\"color: #000000;\">(<\/span><span style=\"color: #000000;\">mcp<\/span><span style=\"color: #434f54;\">.<\/span><span style=\"color: #d35400;\">getLastInterruptPin<\/span><span style=\"color: #000000;\">(<\/span><span style=\"color: #000000;\">)<\/span><span style=\"color: #000000;\">)<\/span><span style=\"color: #000000;\">;<\/span>\r\n \u00a0\u00a0\u00a0<span style=\"color: #d35400;\">delay<\/span><span style=\"color: #000000;\">(<\/span><span style=\"color: #000000;\">250<\/span><span style=\"color: #000000;\">)<\/span><span style=\"color: #000000;\">;<\/span>\r\n \u00a0\u00a0\u00a0<span style=\"color: #000000;\">mcp<\/span><span style=\"color: #434f54;\">.<\/span><span style=\"color: #000000;\">clearInterrupts<\/span><span style=\"color: #000000;\">(<\/span><span style=\"color: #000000;\">)<\/span><span style=\"color: #000000;\">;<\/span> \u00a0<span style=\"color: #434f54;\">\/\/ clear<\/span>\r\n \u00a0<span style=\"color: #000000;\">}<\/span>\r\n<span style=\"color: #000000;\">}<\/span>\r\n<\/pre>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>MCP23017 &#8212;\u00a0 \u0440\u0430\u0441\u0448\u0438\u0440\u0438\u0442\u0435\u043b\u044c \u043f\u043e\u0440\u0442\u043e\u0432 GPIO, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0434\u043e 16 \u0446\u0438\u0444\u0440\u043e\u0432\u044b\u043c\u0438 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430\u043c\u0438 \u0447\u0435\u0440\u0435\u0437 \u043e\u0434\u0438\u043d \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 I2C. \u041e\u043d \u0438\u043c\u0435\u0435\u0442 \u0434\u0432\u0430 \u043f\u043e\u0440\u0442\u0430 \u043f\u043e 8 GPIO \u043a\u0430\u0436\u0434\u044b\u0439, \u0447\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c 16 \u0446\u0438\u0444\u0440\u043e\u0432\u044b\u0445 \u0441\u0438\u0433\u043d\u0430\u043b\u043e\u0432 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0432\u0441\u0435\u0433\u043e \u0434\u0432\u0443\u0445 \u0432\u044b\u0432\u043e\u0434\u043e\u0432 \u043c\u0438\u043a\u0440\u043e\u0441\u0445\u0435\u043c\u044b. \u041e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b MCP23017: &#8212; \u041d\u0430\u043f\u0440\u044f\u0436\u0435\u043d\u0438\u0435 \u043f\u0438\u0442\u0430\u043d\u0438\u044f: 1,8 \u0412 &#8212; 5,5 \u0412 &#8212; \u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u043e\u0440\u0442\u043e\u0432 \u0432\u0432\u043e\u0434\u0430-\u0432\u044b\u0432\u043e\u0434\u0430: 16 (2 \u043f\u043e\u0440\u0442\u0430 \u043f\u043e [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":130548,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[239,21],"tags":[],"class_list":["post-130545","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-arduino","category-21"],"views":5379,"_links":{"self":[{"href":"http:\/\/rcl-radio.ru\/index.php?rest_route=\/wp\/v2\/posts\/130545","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=130545"}],"version-history":[{"count":13,"href":"http:\/\/rcl-radio.ru\/index.php?rest_route=\/wp\/v2\/posts\/130545\/revisions"}],"predecessor-version":[{"id":132094,"href":"http:\/\/rcl-radio.ru\/index.php?rest_route=\/wp\/v2\/posts\/130545\/revisions\/132094"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/rcl-radio.ru\/index.php?rest_route=\/wp\/v2\/media\/130548"}],"wp:attachment":[{"href":"http:\/\/rcl-radio.ru\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=130545"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/rcl-radio.ru\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=130545"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/rcl-radio.ru\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=130545"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}