{"id":104916,"date":"2021-08-11T08:57:27","date_gmt":"2021-08-11T02:57:27","guid":{"rendered":"http:\/\/rcl-radio.ru\/?p=104916"},"modified":"2022-01-08T01:44:09","modified_gmt":"2022-01-07T19:44:09","slug":"%d0%b0%d0%bd%d0%b0%d0%bb%d0%b8%d0%b7%d0%b0%d1%82%d0%be%d1%80-%d1%81%d0%bf%d0%b5%d0%ba%d1%82%d1%80%d0%b0-%d0%bd%d0%b0-led-%d0%bc%d0%b0%d1%82%d1%80%d0%b8%d1%86%d0%b5-4x8x8-max7219","status":"publish","type":"post","link":"http:\/\/rcl-radio.ru\/?p=104916","title":{"rendered":"\u0410\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440 \u0441\u043f\u0435\u043a\u0442\u0440\u0430 \u043d\u0430 LED \u043c\u0430\u0442\u0440\u0438\u0446\u0435 4x8x8 MAX7219"},"content":{"rendered":"<p><a href=\"http:\/\/rcl-radio.ru\/wp-content\/uploads\/2021\/08\/04c8def3982275c21bf30bd84cd9b6c4.png\" class=\"highslide-image\" onclick=\"return hs.expand(this);\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-104917\" src=\"http:\/\/rcl-radio.ru\/wp-content\/uploads\/2021\/08\/04c8def3982275c21bf30bd84cd9b6c4.png\" alt=\"\" width=\"749\" height=\"224\" srcset=\"http:\/\/rcl-radio.ru\/wp-content\/uploads\/2021\/08\/04c8def3982275c21bf30bd84cd9b6c4.png 749w, http:\/\/rcl-radio.ru\/wp-content\/uploads\/2021\/08\/04c8def3982275c21bf30bd84cd9b6c4-200x60.png 200w, http:\/\/rcl-radio.ru\/wp-content\/uploads\/2021\/08\/04c8def3982275c21bf30bd84cd9b6c4-500x150.png 500w\" sizes=\"auto, (max-width: 749px) 100vw, 749px\" \/><\/a><\/p>\n<p>MAX7219 \u2014 \u0434\u0440\u0430\u0439\u0432\u0435\u0440 \u0432\u043e\u0441\u044c\u043c\u0438 \u0440\u0430\u0437\u0440\u044f\u0434\u043d\u043e\u0433\u043e \u0446\u0438\u0444\u0440\u043e\u0432\u043e\u0433\u043e LED \u0438\u043d\u0434\u0438\u043a\u0430\u0442\u043e\u0440\u0430 \u0441 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u043c \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u043e\u043c. \u0414\u0440\u0430\u0439\u0432\u0435\u0440 \u043c\u043e\u0436\u0435\u0442 \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0432\u043e\u0441\u0435\u043c\u044c\u044e \u0441\u0435\u043c\u0438\u0441\u0435\u0433\u043c\u0435\u043d\u0442\u043d\u044b\u043c\u0438 \u0438\u043d\u0434\u0438\u043a\u0430\u0442\u043e\u0440\u0430\u043c\u0438 \u0441 \u0442\u043e\u0447\u043a\u043e\u0439, \u043b\u0438\u0431\u043e \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e 64 \u0441\u0432\u0435\u0442\u043e\u0434\u0438\u043e\u0434\u0430\u043c\u0438 \u0432 LED \u043f\u0430\u043d\u0435\u043b\u044f\u0445 \u0441 \u043e\u0431\u0449\u0438\u043c \u043a\u0430\u0442\u043e\u0434\u043e\u043c.<\/p>\n<p>\u0414\u0440\u0430\u0439\u0432\u0435\u0440 MAX7219 \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u043e \u0442\u0440\u0435\u0445\u043f\u0440\u043e\u0432\u043e\u0434\u043d\u043e\u0439 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u0448\u0438\u043d\u0435 Microwire (3-Wire).\u00a0 \u0414\u0440\u0430\u0439\u0432\u0435\u0440 \u0434\u043e\u043f\u0443\u0441\u043a\u0430\u044e\u0442 \u043a\u0430\u0441\u043a\u0430\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0434\u043b\u044f \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0431\u043e\u043b\u044c\u0448\u0438\u043c \u0447\u0438\u0441\u043b\u043e\u043c \u0438\u043d\u0434\u0438\u043a\u0430\u0442\u043e\u0440\u043e\u0432. \u041a\u0430\u0436\u0434\u044b\u0439 \u0438\u0437 \u0440\u0430\u0437\u0440\u044f\u0434\u043e\u0432 \u0438\u043d\u0434\u0438\u043a\u0430\u0442\u043e\u0440\u0430 \u0438\u043c\u0435\u0435\u0442 \u043d\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u0443\u044e \u0430\u0434\u0440\u0435\u0441\u0430\u0446\u0438\u044e \u0438 \u0435\u0433\u043e \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u043e \u0431\u0435\u0437 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0438\u0441\u0438 \u0432\u0441\u0435\u0433\u043e \u0438\u043d\u0434\u0438\u043a\u0430\u0442\u043e\u0440\u0430. \u0418\u0421 MAX7219 \u0442\u0430\u043a\u0436\u0435 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0442 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0442\u044c \u0440\u0435\u0436\u0438\u043c \u0434\u0435\u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0440\u0430\u0437\u0440\u044f\u0434\u0430.<\/p>\n<p>\u041d\u0430 \u0431\u0430\u0437\u0435 \u043c\u0430\u0442\u0440\u0438\u0446\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f 4 \u043c\u043e\u0434\u0443\u043b\u044f \u043f\u043e 64 \u0441\u0432\u0435\u0442\u043e\u0434\u0438\u043e\u0434\u0430, \u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0431\u0440\u0430\u0442\u044c \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440 \u0441\u043f\u0435\u043a\u0442\u0440\u0430 \u0437\u0432\u0443\u043a\u043e\u0432\u043e\u0433\u043e \u0441\u0438\u0433\u043d\u0430\u043b\u0430. \u041c\u0430\u0442\u0440\u0438\u0446\u0430 \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u043f\u043b\u0430\u0442\u044b Arduino Nano (Atmega8, Atmega168, Atmega328), \u0437\u0432\u0443\u043a\u043e\u0432\u043e\u0439 \u0441\u0438\u0433\u043d\u0430\u043b \u043f\u043e\u0434\u0430\u0435\u0442\u0441\u044f \u043d\u0430 \u0432\u0445\u043e\u0434 \u04100 \u0447\u0435\u0440\u0435\u0437 \u043a\u043e\u043d\u0434\u0435\u043d\u0441\u0430\u0442\u043e\u0440 0.1 \u043c\u043a\u0424.<\/p>\n<p><a href=\"http:\/\/rcl-radio.ru\/wp-content\/uploads\/2021\/08\/MAX-2.gif\" class=\"highslide-image\" onclick=\"return hs.expand(this);\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-104923\" src=\"http:\/\/rcl-radio.ru\/wp-content\/uploads\/2021\/08\/MAX-2.gif\" alt=\"\" width=\"588\" height=\"375\" \/><\/a><\/p>\n<blockquote>\n<p style=\"text-align: center;\"><strong>!!! \u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e \u043f\u0440\u0438 \u043f\u043e\u043b\u043d\u043e\u0439 \u044f\u0440\u043a\u043e\u0441\u0442\u0438 LED \u043c\u0430\u0442\u0440\u0438\u0446\u0430 \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u0442\u0440\u0435\u0431\u043b\u044f\u0442\u044c \u0431\u043e\u043b\u0435\u0435 1,5 \u0410, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0434\u043b\u044f \u043f\u0438\u0442\u0430\u043d\u0438\u044f \u043c\u0430\u0442\u0440\u0438\u0446\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a \u043f\u0438\u0442\u0430\u043d\u0438\u044f 5 \u0412 \u0441 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u043c \u0432\u044b\u0445\u043e\u0434\u043d\u044b\u043c \u0442\u043e\u043a\u043e\u043c \u043d\u0435 \u043c\u0435\u043d\u0435\u0435 2 \u0410!!!<\/strong><\/p>\n<\/blockquote>\n<p><a href=\"http:\/\/rcl-radio.ru\/wp-content\/uploads\/2021\/08\/09cc23c52bd645bbcf3fabeb786d52d3.png\" class=\"highslide-image\" onclick=\"return hs.expand(this);\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-104921 size-full\" src=\"http:\/\/rcl-radio.ru\/wp-content\/uploads\/2021\/08\/09cc23c52bd645bbcf3fabeb786d52d3-e1628649724511.png\" alt=\"\" width=\"752\" height=\"193\" srcset=\"http:\/\/rcl-radio.ru\/wp-content\/uploads\/2021\/08\/09cc23c52bd645bbcf3fabeb786d52d3-e1628649724511.png 752w, http:\/\/rcl-radio.ru\/wp-content\/uploads\/2021\/08\/09cc23c52bd645bbcf3fabeb786d52d3-e1628649724511-200x51.png 200w, http:\/\/rcl-radio.ru\/wp-content\/uploads\/2021\/08\/09cc23c52bd645bbcf3fabeb786d52d3-e1628649724511-500x128.png 500w\" sizes=\"auto, (max-width: 752px) 100vw, 752px\" \/><\/a> <a href=\"http:\/\/rcl-radio.ru\/wp-content\/uploads\/2021\/08\/34ff0611e67633d8327f067df2fad15f.png\" class=\"highslide-image\" onclick=\"return hs.expand(this);\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-104922\" src=\"http:\/\/rcl-radio.ru\/wp-content\/uploads\/2021\/08\/34ff0611e67633d8327f067df2fad15f.png\" alt=\"\" width=\"748\" height=\"215\" srcset=\"http:\/\/rcl-radio.ru\/wp-content\/uploads\/2021\/08\/34ff0611e67633d8327f067df2fad15f.png 748w, http:\/\/rcl-radio.ru\/wp-content\/uploads\/2021\/08\/34ff0611e67633d8327f067df2fad15f-200x57.png 200w, http:\/\/rcl-radio.ru\/wp-content\/uploads\/2021\/08\/34ff0611e67633d8327f067df2fad15f-500x144.png 500w\" sizes=\"auto, (max-width: 748px) 100vw, 748px\" \/><\/a><\/p>\n<div id=\"marketWidget\"><\/div>\n<pre class=\"actionscript\" style=\"font-family: monospace; font-size: 10px;\"><span style=\"color: #808080; font-style: italic;\">\/\/\/\/\/\/\/\/\/\/ |PORT   |pin | Arduino <\/span>\r\n<span style=\"color: #808080; font-style: italic;\">\/\/ MAX7219<\/span>\r\n<span style=\"color: #808080; font-style: italic;\">#define CLK PD2 \/\/ | 4  | D2<\/span>\r\n<span style=\"color: #808080; font-style: italic;\">#define CS  PD3 \/\/ | 5  | D3<\/span>\r\n<span style=\"color: #808080; font-style: italic;\">#define DIN PD4 \/\/ | 6  | D4<\/span>\r\n\u00a0\r\n<span style=\"color: #808080; font-style: italic;\">#define AUTO_GAIN 1        \/\/ \u0430\u0432\u0442\u043e\u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u043f\u043e \u0433\u0440\u043e\u043c\u043a\u043e\u0441\u0442\u0438<\/span>\r\n<span style=\"color: #808080; font-style: italic;\">#define LOW_PASS 40        \/\/ \u043d\u0438\u0436\u043d\u0438\u0439 \u043f\u043e\u0440\u043e\u0433 \u0447\u0443\u0432\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0448\u0443\u043c\u043e\u0432 (\u043d\u0435\u0442 \u0441\u043a\u0430\u0447\u043a\u043e\u0432 \u043f\u0440\u0438 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u0438 \u0437\u0432\u0443\u043a\u0430)<\/span>\r\n<span style=\"color: #808080; font-style: italic;\">#define DEF_GAIN 300       \/\/ \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u043f\u043e\u0440\u043e\u0433 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e <\/span>\r\n<span style=\"color: #808080; font-style: italic;\">#define FHT_N 256          \/\/ \u0448\u0438\u0440\u0438\u043d\u0430 \u0441\u043f\u0435\u043a\u0442\u0440\u0430 \u04452<\/span>\r\n<span style=\"color: #808080; font-style: italic;\">#define LOG_OUT 1<\/span>\r\n<span style=\"color: #808080; font-style: italic;\">#define INPUT_GAIN 1.0 <\/span>\r\n<span style=\"color: #808080; font-style: italic;\">#define BR 0               \/\/ \u044f\u0440\u043a\u043e\u0441\u0442\u044c<\/span>\r\n\u00a0\r\n<span style=\"color: #808080; font-style: italic;\">#include &lt;FHT.h&gt;  \/\/ http:\/\/forum.rcl-radio.ru\/misc.php?action=pan_download&amp;item=297&amp;download=1<\/span>\r\nbyte posOffset<span style=\"color: #66cc66;\">[<\/span><span style=\"color: #cc66cc;\">32<\/span><span style=\"color: #66cc66;\">]<\/span> = <span style=\"color: #66cc66;\">{<\/span><span style=\"color: #cc66cc;\">4<\/span>,<span style=\"color: #cc66cc;\">5<\/span>,<span style=\"color: #cc66cc;\">6<\/span>,<span style=\"color: #cc66cc;\">7<\/span>,<span style=\"color: #cc66cc;\">8<\/span>,<span style=\"color: #cc66cc;\">9<\/span>,<span style=\"color: #cc66cc;\">10<\/span>,<span style=\"color: #cc66cc;\">11<\/span>,<span style=\"color: #cc66cc;\">12<\/span>,<span style=\"color: #cc66cc;\">13<\/span>,<span style=\"color: #cc66cc;\">14<\/span>,<span style=\"color: #cc66cc;\">15<\/span>,<span style=\"color: #cc66cc;\">16<\/span>,<span style=\"color: #cc66cc;\">17<\/span>,<span style=\"color: #cc66cc;\">18<\/span>,<span style=\"color: #cc66cc;\">19<\/span>,<span style=\"color: #cc66cc;\">20<\/span>,<span style=\"color: #cc66cc;\">21<\/span>,<span style=\"color: #cc66cc;\">21<\/span>,<span style=\"color: #cc66cc;\">22<\/span>,<span style=\"color: #cc66cc;\">23<\/span>,<span style=\"color: #cc66cc;\">24<\/span>,<span style=\"color: #cc66cc;\">25<\/span>,<span style=\"color: #cc66cc;\">26<\/span>,<span style=\"color: #cc66cc;\">27<\/span>,<span style=\"color: #cc66cc;\">28<\/span>,<span style=\"color: #cc66cc;\">29<\/span>,<span style=\"color: #cc66cc;\">30<\/span>,<span style=\"color: #cc66cc;\">31<\/span>,<span style=\"color: #cc66cc;\">32<\/span>,<span style=\"color: #cc66cc;\">33<\/span>,<span style=\"color: #cc66cc;\">34<\/span><span style=\"color: #66cc66;\">}<\/span>;\r\n\u00a0\r\n<span style=\"color: #0066cc;\">int<\/span> i1;\r\nunsigned long <span style=\"color: #0066cc;\">data<\/span><span style=\"color: #66cc66;\">[<\/span><span style=\"color: #cc66cc;\">32<\/span><span style=\"color: #66cc66;\">]<\/span>;\r\nunsigned long data1,data2,data3,data4,data5,data6,data7,data8;\r\nbyte a<span style=\"color: #66cc66;\">[<\/span><span style=\"color: #cc66cc;\">32<\/span><span style=\"color: #66cc66;\">]<\/span>;\r\n<span style=\"color: #0066cc;\">int<\/span> ur<span style=\"color: #66cc66;\">[<\/span><span style=\"color: #cc66cc;\">32<\/span><span style=\"color: #66cc66;\">]<\/span>,urr<span style=\"color: #66cc66;\">[<\/span><span style=\"color: #cc66cc;\">32<\/span><span style=\"color: #66cc66;\">]<\/span>;\r\nunsigned long gainTimer;\r\n<span style=\"color: #0066cc;\">int<\/span> gain_sp = DEF_GAIN; \r\n<span style=\"color: #0066cc;\">int<\/span> maxValue; \r\n<span style=\"color: #0066cc;\">int<\/span> maxValue_f;\r\nfloat k = <span style=\"color: #cc66cc;\">0.5<\/span>; \r\n\u00a0\r\n\u00a0\r\n<span style=\"color: #0066cc;\">void<\/span> setup<span style=\"color: #66cc66;\">(<\/span><span style=\"color: #66cc66;\">)<\/span><span style=\"color: #66cc66;\">{<\/span>\r\n   ADMUX  = 0b11000000; ADCSRA = 0b11010110;\r\n  DDRD <span style=\"color: #66cc66;\">|<\/span>= <span style=\"color: #66cc66;\">(<\/span><span style=\"color: #cc66cc;\">1<\/span> <span style=\"color: #66cc66;\">&lt;&lt;<\/span> DIN<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> CS<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> CLK<span style=\"color: #66cc66;\">)<\/span>;\r\n  max7219_L<span style=\"color: #66cc66;\">(<\/span>0x0F, <span style=\"color: #cc66cc;\">0<\/span><span style=\"color: #66cc66;\">)<\/span>;<span style=\"color: #808080; font-style: italic;\">\/\/ \u0442\u0435\u0441\u0442 \u0432\u044b\u043a\u043b.<\/span>\r\n  max7219_L<span style=\"color: #66cc66;\">(<\/span>0x0C, 0x01010101<span style=\"color: #66cc66;\">)<\/span>;<span style=\"color: #808080; font-style: italic;\">\/\/ \u0432\u043a\u043b. \u0438\u043d\u0434\u0438\u043a.<\/span>\r\n  max7219_L<span style=\"color: #66cc66;\">(<\/span>0x0A, 0x01010101<span style=\"color: #66cc66;\">*<\/span>BR<span style=\"color: #66cc66;\">)<\/span>;<span style=\"color: #808080; font-style: italic;\">\/\/ \u044f\u0440\u043a\u043e\u0441\u0442\u044c<\/span>\r\n  max7219_L<span style=\"color: #66cc66;\">(<\/span>0x09, <span style=\"color: #cc66cc;\">0<\/span><span style=\"color: #66cc66;\">)<\/span>;<span style=\"color: #808080; font-style: italic;\">\/\/ \u0434\u0435\u0448\u0438\u0444\u0440\u0430\u0442\u043e\u0440\u044b \u0432\u044b\u043a\u043b.<\/span>\r\n  max7219_L<span style=\"color: #66cc66;\">(<\/span>0x0B, 0x07070707<span style=\"color: #66cc66;\">)<\/span>;<span style=\"color: #808080; font-style: italic;\">\/\/ \u043a\u043e\u043b-\u0432\u043e \u0440\u0430\u0437\u0440\u044f\u0434\u043e\u0432 <\/span>\r\n  <span style=\"color: #66cc66;\">}<\/span>\r\n\u00a0\r\n<span style=\"color: #0066cc;\">void<\/span> loop<span style=\"color: #66cc66;\">(<\/span><span style=\"color: #66cc66;\">)<\/span><span style=\"color: #66cc66;\">{<\/span>\r\n\u00a0\r\n  analyzeAudio<span style=\"color: #66cc66;\">(<\/span><span style=\"color: #66cc66;\">)<\/span>;\r\n\u00a0\r\n      <span style=\"color: #b1b100;\">for<\/span> <span style=\"color: #66cc66;\">(<\/span><span style=\"color: #0066cc;\">int<\/span> i = <span style=\"color: #cc66cc;\">0<\/span>; i <span style=\"color: #66cc66;\">&lt;<\/span> FHT_N<span style=\"color: #66cc66;\">\/<\/span><span style=\"color: #cc66cc;\">2<\/span>; i++<span style=\"color: #66cc66;\">)<\/span> <span style=\"color: #66cc66;\">{<\/span>                     \r\n      <span style=\"color: #b1b100;\">if<\/span> <span style=\"color: #66cc66;\">(<\/span>fht_log_out<span style=\"color: #66cc66;\">[<\/span>i<span style=\"color: #66cc66;\">]<\/span> <span style=\"color: #66cc66;\">&lt;<\/span> LOW_PASS<span style=\"color: #66cc66;\">)<\/span> fht_log_out<span style=\"color: #66cc66;\">[<\/span>i<span style=\"color: #66cc66;\">]<\/span> = <span style=\"color: #cc66cc;\">0<\/span>;\r\n      fht_log_out<span style=\"color: #66cc66;\">[<\/span>i<span style=\"color: #66cc66;\">]<\/span> = <span style=\"color: #66cc66;\">(<\/span>float<span style=\"color: #66cc66;\">)<\/span>fht_log_out<span style=\"color: #66cc66;\">[<\/span>i<span style=\"color: #66cc66;\">]<\/span> <span style=\"color: #66cc66;\">*<\/span> INPUT_GAIN;<span style=\"color: #66cc66;\">}<\/span>\r\n\u00a0\r\n       maxValue = <span style=\"color: #cc66cc;\">0<\/span>;\r\n      <span style=\"color: #b1b100;\">for<\/span> <span style=\"color: #66cc66;\">(<\/span><span style=\"color: #0066cc;\">int<\/span> pos = <span style=\"color: #cc66cc;\">0<\/span>; pos <span style=\"color: #66cc66;\">&lt;<\/span> <span style=\"color: #cc66cc;\">32<\/span>; pos++<span style=\"color: #66cc66;\">)<\/span> <span style=\"color: #66cc66;\">{<\/span>  \r\n        <span style=\"color: #b1b100;\">if<\/span> <span style=\"color: #66cc66;\">(<\/span>fht_log_out<span style=\"color: #66cc66;\">[<\/span>posOffset<span style=\"color: #66cc66;\">[<\/span>pos<span style=\"color: #66cc66;\">]<\/span><span style=\"color: #66cc66;\">]<\/span> <span style=\"color: #66cc66;\">&gt;<\/span> maxValue<span style=\"color: #66cc66;\">)<\/span> maxValue = fht_log_out<span style=\"color: #66cc66;\">[<\/span>posOffset<span style=\"color: #66cc66;\">[<\/span>pos<span style=\"color: #66cc66;\">]<\/span><span style=\"color: #66cc66;\">]<\/span>;\r\n        <span style=\"color: #0066cc;\">int<\/span> posLevel = map<span style=\"color: #66cc66;\">(<\/span>fht_log_out<span style=\"color: #66cc66;\">[<\/span>posOffset<span style=\"color: #66cc66;\">[<\/span>pos<span style=\"color: #66cc66;\">]<\/span><span style=\"color: #66cc66;\">]<\/span>, LOW_PASS, gain_sp, <span style=\"color: #cc66cc;\">0<\/span>, <span style=\"color: #cc66cc;\">8<\/span><span style=\"color: #66cc66;\">)<\/span>;posLevel = constrain<span style=\"color: #66cc66;\">(<\/span>posLevel, <span style=\"color: #cc66cc;\">0<\/span>, <span style=\"color: #cc66cc;\">8<\/span><span style=\"color: #66cc66;\">)<\/span>;\r\n\u00a0\r\n        urr<span style=\"color: #66cc66;\">[<\/span>pos<span style=\"color: #66cc66;\">]<\/span> = posLevel;\r\n        <span style=\"color: #b1b100;\">if<\/span><span style=\"color: #66cc66;\">(<\/span>urr<span style=\"color: #66cc66;\">[<\/span>pos<span style=\"color: #66cc66;\">]<\/span><span style=\"color: #66cc66;\">&lt;<\/span>ur<span style=\"color: #66cc66;\">[<\/span>pos<span style=\"color: #66cc66;\">]<\/span><span style=\"color: #66cc66;\">)<\/span><span style=\"color: #66cc66;\">{<\/span>ur<span style=\"color: #66cc66;\">[<\/span>pos<span style=\"color: #66cc66;\">]<\/span>=ur<span style=\"color: #66cc66;\">[<\/span>pos<span style=\"color: #66cc66;\">]<\/span>-<span style=\"color: #cc66cc;\">1<\/span>;<span style=\"color: #66cc66;\">}<\/span>\r\n        <span style=\"color: #b1b100;\">else<\/span><span style=\"color: #66cc66;\">{<\/span>ur<span style=\"color: #66cc66;\">[<\/span>pos<span style=\"color: #66cc66;\">]<\/span> = posLevel;<span style=\"color: #66cc66;\">}<\/span>\r\n        delayMicroseconds<span style=\"color: #66cc66;\">(<\/span><span style=\"color: #cc66cc;\">10<\/span><span style=\"color: #66cc66;\">)<\/span>;\r\n\u00a0\r\n\u00a0\r\n  <span style=\"color: #b1b100;\">switch<\/span><span style=\"color: #66cc66;\">(<\/span>ur<span style=\"color: #66cc66;\">[<\/span>pos<span style=\"color: #66cc66;\">]<\/span><span style=\"color: #66cc66;\">)<\/span><span style=\"color: #66cc66;\">{<\/span>\r\n    <span style=\"color: #b1b100;\">case<\/span> <span style=\"color: #cc66cc;\">0<\/span>: a<span style=\"color: #66cc66;\">[<\/span>pos<span style=\"color: #66cc66;\">]<\/span>=0b00000000;<span style=\"color: #b1b100;\">break<\/span>;\r\n    <span style=\"color: #b1b100;\">case<\/span> <span style=\"color: #cc66cc;\">1<\/span>: a<span style=\"color: #66cc66;\">[<\/span>pos<span style=\"color: #66cc66;\">]<\/span>=0b00000001;<span style=\"color: #b1b100;\">break<\/span>;\r\n    <span style=\"color: #b1b100;\">case<\/span> <span style=\"color: #cc66cc;\">2<\/span>: a<span style=\"color: #66cc66;\">[<\/span>pos<span style=\"color: #66cc66;\">]<\/span>=0b00000011;<span style=\"color: #b1b100;\">break<\/span>;\r\n    <span style=\"color: #b1b100;\">case<\/span> <span style=\"color: #cc66cc;\">3<\/span>: a<span style=\"color: #66cc66;\">[<\/span>pos<span style=\"color: #66cc66;\">]<\/span>=0b00000111;<span style=\"color: #b1b100;\">break<\/span>;\r\n    <span style=\"color: #b1b100;\">case<\/span> <span style=\"color: #cc66cc;\">4<\/span>: a<span style=\"color: #66cc66;\">[<\/span>pos<span style=\"color: #66cc66;\">]<\/span>=0b00001111;<span style=\"color: #b1b100;\">break<\/span>;\r\n    <span style=\"color: #b1b100;\">case<\/span> <span style=\"color: #cc66cc;\">5<\/span>: a<span style=\"color: #66cc66;\">[<\/span>pos<span style=\"color: #66cc66;\">]<\/span>=0b00011111;<span style=\"color: #b1b100;\">break<\/span>;\r\n    <span style=\"color: #b1b100;\">case<\/span> <span style=\"color: #cc66cc;\">6<\/span>: a<span style=\"color: #66cc66;\">[<\/span>pos<span style=\"color: #66cc66;\">]<\/span>=0b00111111;<span style=\"color: #b1b100;\">break<\/span>;\r\n    <span style=\"color: #b1b100;\">case<\/span> <span style=\"color: #cc66cc;\">7<\/span>: a<span style=\"color: #66cc66;\">[<\/span>pos<span style=\"color: #66cc66;\">]<\/span>=0b01111111;<span style=\"color: #b1b100;\">break<\/span>;\r\n    <span style=\"color: #b1b100;\">case<\/span> <span style=\"color: #cc66cc;\">8<\/span>: a<span style=\"color: #66cc66;\">[<\/span>pos<span style=\"color: #66cc66;\">]<\/span>=0b11111111;<span style=\"color: #b1b100;\">break<\/span>;\r\n    <span style=\"color: #66cc66;\">}<\/span>\r\n     data1 = data1 +  <span style=\"color: #66cc66;\">(<\/span><span style=\"color: #66cc66;\">(<\/span>uint32_t<span style=\"color: #66cc66;\">(<\/span>a<span style=\"color: #66cc66;\">[<\/span>pos<span style=\"color: #66cc66;\">]<\/span> <span style=\"color: #66cc66;\">&gt;&gt;<\/span> <span style=\"color: #cc66cc;\">0<\/span><span style=\"color: #66cc66;\">)<\/span> <span style=\"color: #66cc66;\">&amp;<\/span> <span style=\"color: #cc66cc;\">1<\/span><span style=\"color: #66cc66;\">)<\/span><span style=\"color: #66cc66;\">&lt;&lt;<\/span>pos<span style=\"color: #66cc66;\">)<\/span>;\r\n     data2 = data2 +  <span style=\"color: #66cc66;\">(<\/span><span style=\"color: #66cc66;\">(<\/span>uint32_t<span style=\"color: #66cc66;\">(<\/span>a<span style=\"color: #66cc66;\">[<\/span>pos<span style=\"color: #66cc66;\">]<\/span> <span style=\"color: #66cc66;\">&gt;&gt;<\/span> <span style=\"color: #cc66cc;\">1<\/span><span style=\"color: #66cc66;\">)<\/span> <span style=\"color: #66cc66;\">&amp;<\/span> <span style=\"color: #cc66cc;\">1<\/span><span style=\"color: #66cc66;\">)<\/span><span style=\"color: #66cc66;\">&lt;&lt;<\/span>pos<span style=\"color: #66cc66;\">)<\/span>;\r\n     data3 = data3 +  <span style=\"color: #66cc66;\">(<\/span><span style=\"color: #66cc66;\">(<\/span>uint32_t<span style=\"color: #66cc66;\">(<\/span>a<span style=\"color: #66cc66;\">[<\/span>pos<span style=\"color: #66cc66;\">]<\/span> <span style=\"color: #66cc66;\">&gt;&gt;<\/span> <span style=\"color: #cc66cc;\">2<\/span><span style=\"color: #66cc66;\">)<\/span> <span style=\"color: #66cc66;\">&amp;<\/span> <span style=\"color: #cc66cc;\">1<\/span><span style=\"color: #66cc66;\">)<\/span><span style=\"color: #66cc66;\">&lt;&lt;<\/span>pos<span style=\"color: #66cc66;\">)<\/span>;\r\n     data4 = data4 +  <span style=\"color: #66cc66;\">(<\/span><span style=\"color: #66cc66;\">(<\/span>uint32_t<span style=\"color: #66cc66;\">(<\/span>a<span style=\"color: #66cc66;\">[<\/span>pos<span style=\"color: #66cc66;\">]<\/span> <span style=\"color: #66cc66;\">&gt;&gt;<\/span> <span style=\"color: #cc66cc;\">3<\/span><span style=\"color: #66cc66;\">)<\/span> <span style=\"color: #66cc66;\">&amp;<\/span> <span style=\"color: #cc66cc;\">1<\/span><span style=\"color: #66cc66;\">)<\/span><span style=\"color: #66cc66;\">&lt;&lt;<\/span>pos<span style=\"color: #66cc66;\">)<\/span>;\r\n     data5 = data5 +  <span style=\"color: #66cc66;\">(<\/span><span style=\"color: #66cc66;\">(<\/span>uint32_t<span style=\"color: #66cc66;\">(<\/span>a<span style=\"color: #66cc66;\">[<\/span>pos<span style=\"color: #66cc66;\">]<\/span> <span style=\"color: #66cc66;\">&gt;&gt;<\/span> <span style=\"color: #cc66cc;\">4<\/span><span style=\"color: #66cc66;\">)<\/span> <span style=\"color: #66cc66;\">&amp;<\/span> <span style=\"color: #cc66cc;\">1<\/span><span style=\"color: #66cc66;\">)<\/span><span style=\"color: #66cc66;\">&lt;&lt;<\/span>pos<span style=\"color: #66cc66;\">)<\/span>;\r\n     data6 = data6 +  <span style=\"color: #66cc66;\">(<\/span><span style=\"color: #66cc66;\">(<\/span>uint32_t<span style=\"color: #66cc66;\">(<\/span>a<span style=\"color: #66cc66;\">[<\/span>pos<span style=\"color: #66cc66;\">]<\/span> <span style=\"color: #66cc66;\">&gt;&gt;<\/span> <span style=\"color: #cc66cc;\">5<\/span><span style=\"color: #66cc66;\">)<\/span> <span style=\"color: #66cc66;\">&amp;<\/span> <span style=\"color: #cc66cc;\">1<\/span><span style=\"color: #66cc66;\">)<\/span><span style=\"color: #66cc66;\">&lt;&lt;<\/span>pos<span style=\"color: #66cc66;\">)<\/span>;\r\n     data7 = data7 +  <span style=\"color: #66cc66;\">(<\/span><span style=\"color: #66cc66;\">(<\/span>uint32_t<span style=\"color: #66cc66;\">(<\/span>a<span style=\"color: #66cc66;\">[<\/span>pos<span style=\"color: #66cc66;\">]<\/span> <span style=\"color: #66cc66;\">&gt;&gt;<\/span> <span style=\"color: #cc66cc;\">6<\/span><span style=\"color: #66cc66;\">)<\/span> <span style=\"color: #66cc66;\">&amp;<\/span> <span style=\"color: #cc66cc;\">1<\/span><span style=\"color: #66cc66;\">)<\/span><span style=\"color: #66cc66;\">&lt;&lt;<\/span>pos<span style=\"color: #66cc66;\">)<\/span>;\r\n     data8 = data8 +  <span style=\"color: #66cc66;\">(<\/span><span style=\"color: #66cc66;\">(<\/span>uint32_t<span style=\"color: #66cc66;\">(<\/span>a<span style=\"color: #66cc66;\">[<\/span>pos<span style=\"color: #66cc66;\">]<\/span> <span style=\"color: #66cc66;\">&gt;&gt;<\/span> <span style=\"color: #cc66cc;\">7<\/span><span style=\"color: #66cc66;\">)<\/span> <span style=\"color: #66cc66;\">&amp;<\/span> <span style=\"color: #cc66cc;\">1<\/span><span style=\"color: #66cc66;\">)<\/span><span style=\"color: #66cc66;\">&lt;&lt;<\/span>pos<span style=\"color: #66cc66;\">)<\/span>;\r\n      <span style=\"color: #66cc66;\">}<\/span>\r\n\u00a0\r\n max7219_L<span style=\"color: #66cc66;\">(<\/span><span style=\"color: #cc66cc;\">8<\/span>, data8 <span style=\"color: #66cc66;\">)<\/span>;\r\n max7219_L<span style=\"color: #66cc66;\">(<\/span><span style=\"color: #cc66cc;\">7<\/span>, data7  <span style=\"color: #66cc66;\">)<\/span>;\r\n max7219_L<span style=\"color: #66cc66;\">(<\/span><span style=\"color: #cc66cc;\">6<\/span>, data6  <span style=\"color: #66cc66;\">)<\/span>;\r\n max7219_L<span style=\"color: #66cc66;\">(<\/span><span style=\"color: #cc66cc;\">5<\/span>, data5  <span style=\"color: #66cc66;\">)<\/span>;\r\n max7219_L<span style=\"color: #66cc66;\">(<\/span><span style=\"color: #cc66cc;\">4<\/span>, data4  <span style=\"color: #66cc66;\">)<\/span>;\r\n max7219_L<span style=\"color: #66cc66;\">(<\/span><span style=\"color: #cc66cc;\">3<\/span>, data3  <span style=\"color: #66cc66;\">)<\/span>;\r\n max7219_L<span style=\"color: #66cc66;\">(<\/span><span style=\"color: #cc66cc;\">2<\/span>, data2  <span style=\"color: #66cc66;\">)<\/span>;\r\n max7219_L<span style=\"color: #66cc66;\">(<\/span><span style=\"color: #cc66cc;\">1<\/span>, data1  <span style=\"color: #66cc66;\">)<\/span>;\r\n  data1=<span style=\"color: #cc66cc;\">0<\/span>;data2=<span style=\"color: #cc66cc;\">0<\/span>;data3=<span style=\"color: #cc66cc;\">0<\/span>;data4=<span style=\"color: #cc66cc;\">0<\/span>;data5=<span style=\"color: #cc66cc;\">0<\/span>;data6=<span style=\"color: #cc66cc;\">0<\/span>;data7=<span style=\"color: #cc66cc;\">0<\/span>;data8=<span style=\"color: #cc66cc;\">0<\/span>;\r\n\u00a0\r\n\u00a0\r\n  <span style=\"color: #b1b100;\">if<\/span> <span style=\"color: #66cc66;\">(<\/span>AUTO_GAIN<span style=\"color: #66cc66;\">)<\/span> <span style=\"color: #66cc66;\">{<\/span>\r\n    <span style=\"color: #b1b100;\">if<\/span> <span style=\"color: #66cc66;\">(<\/span>millis<span style=\"color: #66cc66;\">(<\/span><span style=\"color: #66cc66;\">)<\/span> - gainTimer <span style=\"color: #66cc66;\">&gt;<\/span> <span style=\"color: #cc66cc;\">10<\/span><span style=\"color: #66cc66;\">)<\/span> <span style=\"color: #66cc66;\">{<\/span>      \r\n      maxValue_f = maxValue <span style=\"color: #66cc66;\">*<\/span> k + maxValue_f <span style=\"color: #66cc66;\">*<\/span> <span style=\"color: #66cc66;\">(<\/span><span style=\"color: #cc66cc;\">1<\/span> - k<span style=\"color: #66cc66;\">)<\/span>;\r\n      <span style=\"color: #b1b100;\">if<\/span> <span style=\"color: #66cc66;\">(<\/span>maxValue_f <span style=\"color: #66cc66;\">&gt;<\/span> LOW_PASS<span style=\"color: #66cc66;\">)<\/span> gain_sp = maxValue_f;\r\n       <span style=\"color: #b1b100;\">else<\/span> gain_sp = DEF_GAIN;\r\n       gainTimer = millis<span style=\"color: #66cc66;\">(<\/span><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> max7219_L<span style=\"color: #66cc66;\">(<\/span>byte reg_n, unsigned long h<span style=\"color: #66cc66;\">)<\/span><span style=\"color: #66cc66;\">{<\/span>\r\n  byte h1 = h <span style=\"color: #66cc66;\">&gt;&gt;<\/span> <span style=\"color: #cc66cc;\">24<\/span>;\r\n  byte h2 = h <span style=\"color: #66cc66;\">&gt;&gt;<\/span> <span style=\"color: #cc66cc;\">16<\/span>;\r\n  byte h3 = h <span style=\"color: #66cc66;\">&gt;&gt;<\/span> <span style=\"color: #cc66cc;\">8<\/span>;\r\n  byte h4 = h;\r\n  PORTD <span style=\"color: #66cc66;\">&amp;<\/span>=~<span style=\"color: #66cc66;\">(<\/span><span style=\"color: #cc66cc;\">1<\/span> <span style=\"color: #66cc66;\">&lt;&lt;<\/span> CS<span style=\"color: #66cc66;\">)<\/span>;WriteBit16<span style=\"color: #66cc66;\">(<\/span>reg_n,h1<span style=\"color: #66cc66;\">)<\/span>;WriteBit16<span style=\"color: #66cc66;\">(<\/span>reg_n,h2<span style=\"color: #66cc66;\">)<\/span>;WriteBit16<span style=\"color: #66cc66;\">(<\/span>reg_n,h3<span style=\"color: #66cc66;\">)<\/span>;WriteBit16<span style=\"color: #66cc66;\">(<\/span>reg_n,h4<span style=\"color: #66cc66;\">)<\/span>;PORTD <span style=\"color: #66cc66;\">|<\/span>=<span style=\"color: #66cc66;\">(<\/span><span style=\"color: #cc66cc;\">1<\/span> <span style=\"color: #66cc66;\">&lt;&lt;<\/span> CS<span style=\"color: #66cc66;\">)<\/span>;\r\n  <span style=\"color: #66cc66;\">}<\/span>   \r\n\u00a0\r\n<span style=\"color: #0066cc;\">void<\/span> WriteBit16<span style=\"color: #66cc66;\">(<\/span>byte reg, byte <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>char i = <span style=\"color: #cc66cc;\">7<\/span>; i <span style=\"color: #66cc66;\">&gt;<\/span>= <span style=\"color: #cc66cc;\">0<\/span>; i--<span style=\"color: #66cc66;\">)<\/span><span style=\"color: #66cc66;\">{<\/span>\r\n        PORTD <span style=\"color: #66cc66;\">&amp;<\/span>= ~<span style=\"color: #66cc66;\">(<\/span><span style=\"color: #cc66cc;\">1<\/span> <span style=\"color: #66cc66;\">&lt;&lt;<\/span> CLK<span style=\"color: #66cc66;\">)<\/span>;\r\n        <span style=\"color: #b1b100;\">if<\/span><span style=\"color: #66cc66;\">(<\/span><span style=\"color: #66cc66;\">(<\/span><span style=\"color: #66cc66;\">(<\/span>reg <span style=\"color: #66cc66;\">&gt;&gt;<\/span> i<span style=\"color: #66cc66;\">)<\/span> <span style=\"color: #66cc66;\">&amp;<\/span> <span style=\"color: #cc66cc;\">1<\/span><span style=\"color: #66cc66;\">)<\/span> == <span style=\"color: #cc66cc;\">1<\/span><span style=\"color: #66cc66;\">)<\/span><span style=\"color: #66cc66;\">{<\/span>PORTD <span style=\"color: #66cc66;\">|<\/span>= <span style=\"color: #66cc66;\">(<\/span><span style=\"color: #cc66cc;\">1<\/span> <span style=\"color: #66cc66;\">&lt;&lt;<\/span> DIN<span style=\"color: #66cc66;\">)<\/span>;<span style=\"color: #66cc66;\">}<\/span><span style=\"color: #b1b100;\">else<\/span><span style=\"color: #66cc66;\">{<\/span>PORTD <span style=\"color: #66cc66;\">&amp;<\/span>= ~<span style=\"color: #66cc66;\">(<\/span><span style=\"color: #cc66cc;\">1<\/span> <span style=\"color: #66cc66;\">&lt;&lt;<\/span> DIN<span style=\"color: #66cc66;\">)<\/span>;<span style=\"color: #66cc66;\">}<\/span>\r\n        PORTD <span style=\"color: #66cc66;\">|<\/span>=<span style=\"color: #66cc66;\">(<\/span><span style=\"color: #cc66cc;\">1<\/span> <span style=\"color: #66cc66;\">&lt;&lt;<\/span> CLK<span style=\"color: #66cc66;\">)<\/span>;<span style=\"color: #66cc66;\">}<\/span>\r\n     <span style=\"color: #b1b100;\">for<\/span><span style=\"color: #66cc66;\">(<\/span>char i = <span style=\"color: #cc66cc;\">7<\/span>; i <span style=\"color: #66cc66;\">&gt;<\/span>= <span style=\"color: #cc66cc;\">0<\/span>; i--<span style=\"color: #66cc66;\">)<\/span><span style=\"color: #66cc66;\">{<\/span>\r\n        PORTD <span style=\"color: #66cc66;\">&amp;<\/span>= ~<span style=\"color: #66cc66;\">(<\/span><span style=\"color: #cc66cc;\">1<\/span> <span style=\"color: #66cc66;\">&lt;&lt;<\/span> CLK<span style=\"color: #66cc66;\">)<\/span>;\r\n        <span style=\"color: #b1b100;\">if<\/span><span style=\"color: #66cc66;\">(<\/span><span style=\"color: #66cc66;\">(<\/span><span style=\"color: #66cc66;\">(<\/span><span style=\"color: #0066cc;\">data<\/span> <span style=\"color: #66cc66;\">&gt;&gt;<\/span> i<span style=\"color: #66cc66;\">)<\/span> <span style=\"color: #66cc66;\">&amp;<\/span> <span style=\"color: #cc66cc;\">1<\/span><span style=\"color: #66cc66;\">)<\/span> == <span style=\"color: #cc66cc;\">1<\/span><span style=\"color: #66cc66;\">)<\/span><span style=\"color: #66cc66;\">{<\/span>PORTD <span style=\"color: #66cc66;\">|<\/span>= <span style=\"color: #66cc66;\">(<\/span><span style=\"color: #cc66cc;\">1<\/span> <span style=\"color: #66cc66;\">&lt;&lt;<\/span> DIN<span style=\"color: #66cc66;\">)<\/span>;<span style=\"color: #66cc66;\">}<\/span><span style=\"color: #b1b100;\">else<\/span><span style=\"color: #66cc66;\">{<\/span>PORTD <span style=\"color: #66cc66;\">&amp;<\/span>= ~<span style=\"color: #66cc66;\">(<\/span><span style=\"color: #cc66cc;\">1<\/span> <span style=\"color: #66cc66;\">&lt;&lt;<\/span> DIN<span style=\"color: #66cc66;\">)<\/span>;<span style=\"color: #66cc66;\">}<\/span>\r\n        PORTD <span style=\"color: #66cc66;\">|<\/span>=<span style=\"color: #66cc66;\">(<\/span><span style=\"color: #cc66cc;\">1<\/span> <span style=\"color: #66cc66;\">&lt;&lt;<\/span> CLK<span style=\"color: #66cc66;\">)<\/span>;<span style=\"color: #66cc66;\">}<\/span>\r\n        PORTD <span style=\"color: #66cc66;\">&amp;<\/span>= ~<span style=\"color: #66cc66;\">(<\/span><span style=\"color: #cc66cc;\">1<\/span> <span style=\"color: #66cc66;\">&lt;&lt;<\/span> CLK<span style=\"color: #66cc66;\">)<\/span>;PORTD <span style=\"color: #66cc66;\">|<\/span>= <span style=\"color: #66cc66;\">(<\/span><span style=\"color: #cc66cc;\">1<\/span> <span style=\"color: #66cc66;\">&lt;&lt;<\/span> DIN<span style=\"color: #66cc66;\">)<\/span>;\r\n  <span style=\"color: #66cc66;\">}<\/span> \r\n\u00a0\r\n<span style=\"color: #0066cc;\">void<\/span> analyzeAudio<span style=\"color: #66cc66;\">(<\/span><span style=\"color: #66cc66;\">)<\/span> <span style=\"color: #66cc66;\">{<\/span> \r\n <span style=\"color: #b1b100;\">while<\/span><span style=\"color: #66cc66;\">(<\/span>i1 <span style=\"color: #66cc66;\">&lt;<\/span> FHT_N<span style=\"color: #66cc66;\">)<\/span><span style=\"color: #66cc66;\">{<\/span>i1++; \r\n    <span style=\"color: #b1b100;\">do<\/span><span style=\"color: #66cc66;\">{<\/span>ADCSRA <span style=\"color: #66cc66;\">|<\/span>= <span style=\"color: #66cc66;\">(<\/span><span style=\"color: #cc66cc;\">1<\/span> <span style=\"color: #66cc66;\">&lt;&lt;<\/span> ADSC<span style=\"color: #66cc66;\">)<\/span>;<span style=\"color: #66cc66;\">}<\/span> \r\n    <span style=\"color: #b1b100;\">while<\/span><span style=\"color: #66cc66;\">(<\/span><span style=\"color: #66cc66;\">(<\/span>ADCSRA <span style=\"color: #66cc66;\">&amp;<\/span> <span style=\"color: #66cc66;\">(<\/span><span style=\"color: #cc66cc;\">1<\/span> <span style=\"color: #66cc66;\">&lt;&lt;<\/span> ADIF<span style=\"color: #66cc66;\">)<\/span><span style=\"color: #66cc66;\">)<\/span> == <span style=\"color: #cc66cc;\">0<\/span><span style=\"color: #66cc66;\">)<\/span>;fht_input<span style=\"color: #66cc66;\">[<\/span>i1<span style=\"color: #66cc66;\">]<\/span> = <span style=\"color: #66cc66;\">(<\/span>ADCL<span style=\"color: #66cc66;\">|<\/span>ADCH <span style=\"color: #66cc66;\">&lt;&lt;<\/span> <span style=\"color: #cc66cc;\">8<\/span><span style=\"color: #66cc66;\">)<\/span>;<span style=\"color: #66cc66;\">}<\/span>i1=<span style=\"color: #cc66cc;\">0<\/span>;\r\n    fht_window<span style=\"color: #66cc66;\">(<\/span><span style=\"color: #66cc66;\">)<\/span>; <span style=\"color: #808080; font-style: italic;\">\/\/ window the data for better frequency response<\/span>\r\n    fht_reorder<span style=\"color: #66cc66;\">(<\/span><span style=\"color: #66cc66;\">)<\/span>; <span style=\"color: #808080; font-style: italic;\">\/\/ reorder the data before doing the fht<\/span>\r\n    fht_run<span style=\"color: #66cc66;\">(<\/span><span style=\"color: #66cc66;\">)<\/span>; <span style=\"color: #808080; font-style: italic;\">\/\/ process the data in the fht<\/span>\r\n    fht_mag_log<span style=\"color: #66cc66;\">(<\/span><span style=\"color: #66cc66;\">)<\/span>; <span style=\"color: #808080; font-style: italic;\">\/\/ take the output of the fht<\/span>\r\n<span style=\"color: #66cc66;\">}<\/span><\/pre>\n<p>\u0421\u043a\u0435\u0442\u0447 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430 \u0441\u043f\u0435\u043a\u0442\u0440\u0430 \u0438\u043c\u0435\u0435\u0442 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0436\u043d\u043e \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c:<\/p>\n<ul>\n<li>#define LOW_PASS 40 \/\/ \u043d\u0438\u0436\u043d\u0438\u0439 \u043f\u043e\u0440\u043e\u0433 \u0447\u0443\u0432\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0448\u0443\u043c\u043e\u0432 (\u0443\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u0441\u043a\u0430\u0447\u043a\u043e\u0432 \u043f\u0440\u0438 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u0438 \u0437\u0432\u0443\u043a\u0430)<\/li>\n<li>#define DEF_GAIN 300 \/\/ \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u043f\u043e\u0440\u043e\u0433 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e<\/li>\n<li>#define INPUT_GAIN 1.0 \/\/ \u043f\u0440\u0435\u0434\u0443\u0441\u0438\u043b\u0438\u0442\u0435\u043b\u044c \u0432\u0445\u043e\u0434\u0430<\/li>\n<li>#define BR 0 \/\/ \u044f\u0440\u043a\u043e\u0441\u0442\u044c \u043c\u0430\u0442\u0440\u0438\u0446\u044b<\/li>\n<\/ul>\n<p>\u041f\u0438\u0442\u0430\u043d\u0438\u0435 \u043c\u0430\u0442\u0440\u0438\u0446\u044b \u043c\u043e\u0436\u043d\u043e \u0431\u0440\u0430\u0442\u044c \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e \u0441 \u043f\u043b\u0430\u0442\u044b Arduino, \u043d\u043e \u043f\u0440\u0438 \u0443\u0441\u043b\u043e\u0432\u0438\u0438 \u0447\u0442\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u044f\u0440\u043a\u043e\u0441\u0442\u0438 <strong>#define BR<\/strong> \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0435\u0432\u044b\u0448\u0430\u0442\u044c 3. \u041f\u0440\u0438 \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u044f\u0440\u043a\u043e\u0441\u0442\u0438 \u043c\u0430\u0442\u0440\u0438\u0446\u0430 \u0434\u043e\u043b\u0436\u043d\u0430 \u043f\u0438\u0442\u0430\u0442\u044c\u0441\u044f \u043e\u0442 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0430 \u043f\u0438\u0442\u0430\u043d\u0438\u044f \u043d\u0430\u043f\u0440\u044f\u0436\u0435\u043d\u0438\u0435\u043c 5 \u0412 \u0441 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u043c \u0442\u043e\u043a\u043e\u043c 1.5-2.0 \u0410. \u0422\u0430\u043a \u0436\u0435 \u043f\u0440\u0438 \u043f\u0438\u0442\u0430\u043d\u0438\u0438 \u043c\u0430\u0442\u0440\u0438\u0446\u044b \u043e\u0442 \u043f\u043b\u0430\u0442\u044b Arduino, \u043f\u0438\u0442\u0430\u043d\u0438\u0435 \u043d\u0430 \u043c\u0430\u0442\u0440\u0438\u0446\u0443 \u043f\u043e\u0434\u0430\u0435\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u0441\u043b\u0435 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u0441\u043a\u0435\u0442\u0447\u0430.<\/p>\n<p style=\"text-align: center;\"><iframe loading=\"lazy\" title=\"YouTube video player\" src=\"https:\/\/www.youtube.com\/embed\/YrNoWnf76IA\" width=\"640\" height=\"385\" frameborder=\"0\" allowfullscreen=\"allowfullscreen\"><\/iframe><\/p>\n<p>\u0424\u043e\u0440\u0443\u043c &#8212; <a href=\"http:\/\/forum.rcl-radio.ru\/viewtopic.php?id=415\">http:\/\/forum.rcl-radio.ru\/viewtopic.php?id=415<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>MAX7219 \u2014 \u0434\u0440\u0430\u0439\u0432\u0435\u0440 \u0432\u043e\u0441\u044c\u043c\u0438 \u0440\u0430\u0437\u0440\u044f\u0434\u043d\u043e\u0433\u043e \u0446\u0438\u0444\u0440\u043e\u0432\u043e\u0433\u043e LED \u0438\u043d\u0434\u0438\u043a\u0430\u0442\u043e\u0440\u0430 \u0441 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u043c \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u043e\u043c. \u0414\u0440\u0430\u0439\u0432\u0435\u0440 \u043c\u043e\u0436\u0435\u0442 \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0432\u043e\u0441\u0435\u043c\u044c\u044e \u0441\u0435\u043c\u0438\u0441\u0435\u0433\u043c\u0435\u043d\u0442\u043d\u044b\u043c\u0438 \u0438\u043d\u0434\u0438\u043a\u0430\u0442\u043e\u0440\u0430\u043c\u0438 \u0441 \u0442\u043e\u0447\u043a\u043e\u0439, \u043b\u0438\u0431\u043e \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e 64 \u0441\u0432\u0435\u0442\u043e\u0434\u0438\u043e\u0434\u0430\u043c\u0438 \u0432 LED \u043f\u0430\u043d\u0435\u043b\u044f\u0445 \u0441 \u043e\u0431\u0449\u0438\u043c \u043a\u0430\u0442\u043e\u0434\u043e\u043c. \u0414\u0440\u0430\u0439\u0432\u0435\u0440 MAX7219 \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u043e \u0442\u0440\u0435\u0445\u043f\u0440\u043e\u0432\u043e\u0434\u043d\u043e\u0439 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u0448\u0438\u043d\u0435 Microwire (3-Wire).\u00a0 \u0414\u0440\u0430\u0439\u0432\u0435\u0440 \u0434\u043e\u043f\u0443\u0441\u043a\u0430\u044e\u0442 \u043a\u0430\u0441\u043a\u0430\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0434\u043b\u044f \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0431\u043e\u043b\u044c\u0448\u0438\u043c \u0447\u0438\u0441\u043b\u043e\u043c \u0438\u043d\u0434\u0438\u043a\u0430\u0442\u043e\u0440\u043e\u0432. \u041a\u0430\u0436\u0434\u044b\u0439 \u0438\u0437 \u0440\u0430\u0437\u0440\u044f\u0434\u043e\u0432 \u0438\u043d\u0434\u0438\u043a\u0430\u0442\u043e\u0440\u0430 \u0438\u043c\u0435\u0435\u0442 \u043d\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u0443\u044e \u0430\u0434\u0440\u0435\u0441\u0430\u0446\u0438\u044e \u0438 \u0435\u0433\u043e [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":104917,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[239,15,18],"tags":[],"class_list":["post-104916","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-arduino","category-15","category-18"],"views":7064,"_links":{"self":[{"href":"http:\/\/rcl-radio.ru\/index.php?rest_route=\/wp\/v2\/posts\/104916","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=104916"}],"version-history":[{"count":3,"href":"http:\/\/rcl-radio.ru\/index.php?rest_route=\/wp\/v2\/posts\/104916\/revisions"}],"predecessor-version":[{"id":111121,"href":"http:\/\/rcl-radio.ru\/index.php?rest_route=\/wp\/v2\/posts\/104916\/revisions\/111121"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/rcl-radio.ru\/index.php?rest_route=\/wp\/v2\/media\/104917"}],"wp:attachment":[{"href":"http:\/\/rcl-radio.ru\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=104916"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/rcl-radio.ru\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=104916"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/rcl-radio.ru\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=104916"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}