{"id":42903,"date":"2018-06-15T19:21:56","date_gmt":"2018-06-15T13:21:56","guid":{"rendered":"http:\/\/rcl-radio.ru\/?p=42903"},"modified":"2023-03-17T21:49:49","modified_gmt":"2023-03-17T15:49:49","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%b0%d1%83%d0%b4%d0%b8%d0%be-%d1%81%d0%b8%d0%b3%d0%bd%d0%b0%d0%bb%d0%b0-arduino","status":"publish","type":"post","link":"http:\/\/rcl-radio.ru\/?p=42903","title":{"rendered":"\u0410\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440 \u0441\u043f\u0435\u043a\u0442\u0440\u0430 \u0430\u0443\u0434\u0438\u043e \u0441\u0438\u0433\u043d\u0430\u043b\u0430 (Arduino)"},"content":{"rendered":"<p><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-42904 size-thumbnail alignright\" src=\"http:\/\/rcl-radio.ru\/wp-content\/uploads\/2018\/06\/IMG_20180615_160641-200x150.jpg\" alt=\"\" width=\"200\" height=\"150\" srcset=\"http:\/\/rcl-radio.ru\/wp-content\/uploads\/2018\/06\/IMG_20180615_160641-200x150.jpg 200w, http:\/\/rcl-radio.ru\/wp-content\/uploads\/2018\/06\/IMG_20180615_160641-500x375.jpg 500w, http:\/\/rcl-radio.ru\/wp-content\/uploads\/2018\/06\/IMG_20180615_160641-768x576.jpg 768w, http:\/\/rcl-radio.ru\/wp-content\/uploads\/2018\/06\/IMG_20180615_160641-1024x768.jpg 1024w\" sizes=\"auto, (max-width: 200px) 100vw, 200px\" \/><\/p>\n<p>\u0414\u043b\u044f \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430 \u0441\u043f\u0435\u043a\u0442\u0440\u0430 \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f Arduino Nano (Uno) \u0438 LCD \u0434\u0438\u0441\u043f\u043b\u0435\u0439 1602, \u043d\u0430 \u0431\u0430\u0437\u0435 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430 HD44780, \u0442\u0430\u043a \u0436\u0435 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f <strong><a href=\"http:\/\/wiki.openmusiclabs.com\/wiki\/ArduinoFHT?action=AttachFile&amp;do=get&amp;target=ArduinoFHT4.zip\">\u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 FHT.h<\/a><\/strong>. \u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0430 \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430 \u0441\u043f\u0435\u043a\u0442\u0440\u0430 \u0431\u044b\u043b \u0432\u044b\u0431\u0440\u0430\u043d <a href=\"https:\/\/github.com\/AlexGyver\/FHTSpectrumAnalyzer\/blob\/master\/Firmware\/spertrum1602\/spertrum1602.ino\">\u043f\u0440\u043e\u0435\u043a\u0442 <strong>FHTSpectrumAnalyzer<\/strong><\/a>, \u0432 \u043a\u043e\u0434 \u0431\u044b\u043b\u0438 \u0432\u043d\u0435\u0441\u0435\u043d\u044b \u043d\u0435\u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f, \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0434\u0438\u0441\u043f\u043b\u0435\u044f \u043f\u043e\u00a0I2C \u0431\u044b\u043b\u043e \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u043e \u043d\u0430 4-\u0445 \u0431\u0438\u0442\u043d\u044b\u0439 \u0440\u0435\u0436\u0438\u043c, \u043e\u043f\u043e\u0440\u043d\u043e\u0435 \u043d\u0430\u043f\u0440\u044f\u0436\u0435\u043d\u0438\u0435 \u0410\u0426\u041f \u0431\u044b\u043b\u043e \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0435\u043d\u043e \u043d\u0430 \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0435\u0435 1,1 \u0412.<\/p>\n<p>\u0417\u0432\u0443\u043a\u043e\u0432\u043e\u0439 \u0441\u0438\u0433\u043d\u0430\u043b \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0447\u0435\u0440\u0435\u0437 \u043a\u043e\u043d\u0434\u0435\u043d\u0441\u0430\u0442\u043e\u0440 47 \u043d\u0424 \u043f\u043e\u0434\u0430\u0435\u0442\u0441\u044f \u043d\u0430 \u0430\u043d\u0430\u043b\u043e\u0433\u043e\u0432\u044b\u0439 \u0432\u0445\u043e\u0434 \u04100, \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440 \u0441\u043f\u0435\u043a\u0442\u0440\u0430 \u0438\u043c\u0435\u0435\u0442 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u0443\u0441\u0438\u043b\u0435\u043d\u0438\u0435 \u0432\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u0441\u0438\u0433\u043d\u0430\u043b\u0430, \u0447\u0442\u043e \u0443\u043b\u0443\u0447\u0448\u0430\u0435\u0442 \u0432\u0438\u0437\u0443\u0430\u043b\u044c\u043d\u0443\u044e \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0443 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430 \u0441\u043f\u0435\u043a\u0442\u0440\u0430.<\/p>\n<div id=\"marketWidget\"><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-42905\" src=\"http:\/\/rcl-radio.ru\/wp-content\/uploads\/2018\/06\/378465873249692384.png\" alt=\"\" width=\"525\" height=\"420\" srcset=\"http:\/\/rcl-radio.ru\/wp-content\/uploads\/2018\/06\/378465873249692384.png 525w, http:\/\/rcl-radio.ru\/wp-content\/uploads\/2018\/06\/378465873249692384-200x160.png 200w, http:\/\/rcl-radio.ru\/wp-content\/uploads\/2018\/06\/378465873249692384-500x400.png 500w\" sizes=\"auto, (max-width: 525px) 100vw, 525px\" \/><\/p>\n<pre style=\"background: #0c1021; color: #f8f8f8;\">#define AUTO_GAIN <span style=\"color: #d8fa3c;\">1<\/span>       <span style=\"color: #aeaeae;\">\/\/ \u0430\u0432\u0442\u043e\u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u043f\u043e \u0433\u0440\u043e\u043c\u043a\u043e\u0441\u0442\u0438 (\u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0430\u043b\u044c\u043d\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f)<\/span>\r\n#define VOL_THR <span style=\"color: #d8fa3c;\">35<\/span>        <span style=\"color: #aeaeae;\">\/\/ \u043f\u043e\u0440\u043e\u0433 \u0442\u0438\u0448\u0438\u043d\u044b (\u043d\u0438\u0436\u0435 \u043d\u0435\u0433\u043e \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043d\u0430 \u043c\u0430\u0442\u0440\u0438\u0446\u0435 \u043d\u0435 \u0431\u0443\u0434\u0435\u0442)<\/span>\r\n#define LOW_PASS <span style=\"color: #d8fa3c;\">30<\/span>        <span style=\"color: #aeaeae;\">\/\/ \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#define DEF_GAIN <span style=\"color: #d8fa3c;\">80<\/span>       <span style=\"color: #aeaeae;\">\/\/ \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 (\u043f\u0440\u0438 GAIN_CONTROL \u0438\u0433\u043d\u043e\u0440\u0438\u0440\u0443\u0435\u0442\u0441\u044f)<\/span>\r\n#define FHT_N <span style=\"color: #d8fa3c;\">256<\/span>          <span style=\"color: #aeaeae;\">\/\/ \u0448\u0438\u0440\u0438\u043d\u0430 \u0441\u043f\u0435\u043a\u0442\u0440\u0430 \u04452<\/span>\r\n<span style=\"color: #aeaeae;\">\/\/ \u0432\u0440\u0443\u0447\u043d\u0443\u044e \u0437\u0430\u0431\u0438\u0442\u044b\u0439 \u043c\u0430\u0441\u0441\u0438\u0432 \u0442\u043e\u043d\u043e\u0432, \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u043f\u043b\u0430\u0432\u043d\u043e, \u043f\u043e\u0442\u043e\u043c \u043a\u0440\u0443\u0447\u0435<\/span>\r\nbyte posOffset[<span style=\"color: #d8fa3c;\">16<\/span>] <span style=\"color: #fbde2d;\">=<\/span> {<span style=\"color: #d8fa3c;\">2<\/span>, <span style=\"color: #d8fa3c;\">3<\/span>, <span style=\"color: #d8fa3c;\">4<\/span>, <span style=\"color: #d8fa3c;\">6<\/span>, <span style=\"color: #d8fa3c;\">8<\/span>, <span style=\"color: #d8fa3c;\">10<\/span>, <span style=\"color: #d8fa3c;\">12<\/span>, <span style=\"color: #d8fa3c;\">14<\/span>, <span style=\"color: #d8fa3c;\">16<\/span>, <span style=\"color: #d8fa3c;\">20<\/span>, <span style=\"color: #d8fa3c;\">25<\/span>, <span style=\"color: #d8fa3c;\">30<\/span>, <span style=\"color: #d8fa3c;\">35<\/span>, <span style=\"color: #d8fa3c;\">60<\/span>, <span style=\"color: #d8fa3c;\">80<\/span>, <span style=\"color: #d8fa3c;\">100<\/span>};\r\n\r\n#define LOG_OUT <span style=\"color: #d8fa3c;\">1<\/span>\r\n#include &lt;FHT.h&gt;          \r\n#include &lt;LiquidCrystal.h&gt;\r\nLiquidCrystal lcd(<span style=\"color: #d8fa3c;\">12<\/span>, <span style=\"color: #d8fa3c;\">11<\/span>, <span style=\"color: #d8fa3c;\">5<\/span>, <span style=\"color: #d8fa3c;\">4<\/span>, <span style=\"color: #d8fa3c;\">3<\/span>, <span style=\"color: #d8fa3c;\">2<\/span>);\r\n#define cbi(sfr, bit) (_SFR_BYTE(sfr) <span style=\"color: #fbde2d;\">&amp;<\/span><span style=\"color: #fbde2d;\">=<\/span> ~_BV(bit))\r\n#define sbi(sfr, bit) (_SFR_BYTE(sfr) |<span style=\"color: #fbde2d;\">=<\/span> _BV(bit))\r\n\r\nbyte v1[<span style=\"color: #d8fa3c;\">8<\/span>] <span style=\"color: #fbde2d;\">=<\/span> {0b00000, 0b00000, 0b00000, 0b00000, 0b00000, 0b00000, 0b00000, 0b11011};\r\nbyte v2[<span style=\"color: #d8fa3c;\">8<\/span>] <span style=\"color: #fbde2d;\">=<\/span> {0b00000, 0b00000, 0b00000, 0b00000, 0b00000, 0b00000, 0b11011, 0b11011};\r\nbyte v3[<span style=\"color: #d8fa3c;\">8<\/span>] <span style=\"color: #fbde2d;\">=<\/span> {0b00000, 0b00000, 0b00000, 0b00000, 0b00000, 0b11011, 0b11011, 0b11011};\r\nbyte v4[<span style=\"color: #d8fa3c;\">8<\/span>] <span style=\"color: #fbde2d;\">=<\/span> {0b00000, 0b00000, 0b00000, 0b00000, 0b11011, 0b11011, 0b11011, 0b11011};\r\nbyte v5[<span style=\"color: #d8fa3c;\">8<\/span>] <span style=\"color: #fbde2d;\">=<\/span> {0b00000, 0b00000, 0b00000, 0b11011, 0b11011, 0b11011, 0b11011, 0b11011};\r\nbyte v6[<span style=\"color: #d8fa3c;\">8<\/span>] <span style=\"color: #fbde2d;\">=<\/span> {0b00000, 0b00000, 0b11011, 0b11011, 0b11011, 0b11011, 0b11011, 0b11011};\r\nbyte v7[<span style=\"color: #d8fa3c;\">8<\/span>] <span style=\"color: #fbde2d;\">=<\/span> {0b00000, 0b11011, 0b11011, 0b11011, 0b11011, 0b11011, 0b11011, 0b11011};\r\nbyte v8[<span style=\"color: #d8fa3c;\">8<\/span>] <span style=\"color: #fbde2d;\">=<\/span> {0b11011, 0b11011, 0b11011, 0b11011, 0b11011, 0b11011, 0b11011, 0b11011};\r\n\r\nbyte <span style=\"color: #8da6ce;\">gain<\/span> <span style=\"color: #fbde2d;\">=<\/span> DEF_GAIN;   \r\nunsigned long gainTimer;\r\nbyte maxValue, maxValue_f;\r\nfloat k <span style=\"color: #fbde2d;\">=<\/span> <span style=\"color: #d8fa3c;\">0.1<\/span>;\r\n\r\n<span style=\"color: #8da6ce;\">void<\/span> setup() { \r\n  lcd.begin(<span style=\"color: #d8fa3c;\">16<\/span>, <span style=\"color: #d8fa3c;\">2<\/span>);<span style=\"color: #aeaeae;\">\/\/ LCD 16X2<\/span>\r\n  sbi(ADCSRA, ADPS2);\r\n  cbi(ADCSRA, ADPS1);\r\n  sbi(ADCSRA, ADPS0);\r\n  analogReference(INTERNAL);\r\n  lcd.createChar(<span style=\"color: #d8fa3c;\">0<\/span>, v1);\r\n  lcd.createChar(<span style=\"color: #d8fa3c;\">1<\/span>, v2);\r\n  lcd.createChar(<span style=\"color: #d8fa3c;\">2<\/span>, v3);\r\n  lcd.createChar(<span style=\"color: #d8fa3c;\">3<\/span>, v4);\r\n  lcd.createChar(<span style=\"color: #d8fa3c;\">4<\/span>, v5);\r\n  lcd.createChar(<span style=\"color: #d8fa3c;\">5<\/span>, v6);\r\n  lcd.createChar(<span style=\"color: #d8fa3c;\">6<\/span>, v7);\r\n  lcd.createChar(<span style=\"color: #d8fa3c;\">7<\/span>, v8);\r\n}\r\n\r\n<span style=\"color: #8da6ce;\">void<\/span> loop() {\r\n  analyzeAudio();   <span style=\"color: #aeaeae;\">\/\/ \u0444\u0443\u043d\u043a\u0446\u0438\u044f FHT, \u0437\u0430\u0431\u0438\u0432\u0430\u0435\u0442 \u043c\u0430\u0441\u0441\u0438\u0432 fht_log_out[] \u0432\u0435\u043b\u0438\u0447\u0438\u043d\u0430\u043c\u0438 \u043f\u043e \u0441\u043f\u0435\u043a\u0442\u0440\u0443<\/span>\r\n\r\n  <span style=\"color: #fbde2d;\">for<\/span> (<span style=\"color: #8da6ce;\">int<\/span> pos <span style=\"color: #fbde2d;\">=<\/span> <span style=\"color: #d8fa3c;\">0<\/span>; pos &lt; <span style=\"color: #d8fa3c;\">16<\/span>; pos<span style=\"color: #fbde2d;\">+<\/span><span style=\"color: #fbde2d;\">+<\/span>) {   <span style=\"color: #aeaeae;\">\/\/ \u0434\u043b\u044f \u043e\u043a\u043e\u0448\u0435\u043a \u0434\u0438\u0441\u043f\u043b\u0435\u044f \u0441 0 \u043f\u043e 15<\/span>\r\n    <span style=\"color: #aeaeae;\">\/\/ \u043d\u0430\u0439\u0442\u0438 \u043c\u0430\u043a\u0441\u0438\u043c\u0443\u043c \u0438\u0437 \u043f\u0430\u0447\u043a\u0438 \u0442\u043e\u043d\u043e\u0432<\/span>\r\n    <span style=\"color: #fbde2d;\">if<\/span> (fht_log_out[posOffset[pos]] &gt; maxValue) maxValue <span style=\"color: #fbde2d;\">=<\/span> fht_log_out[posOffset[pos]];\r\n\r\n    lcd.setCursor(pos, <span style=\"color: #d8fa3c;\">0<\/span>);\r\n\r\n    <span style=\"color: #aeaeae;\">\/\/ \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0432\u0435\u043b\u0438\u0447\u0438\u043d\u044b \u0441\u043f\u0435\u043a\u0442\u0440\u0430 \u0432 \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d 0..15 \u0441 \u0443\u0447\u0451\u0442\u043e\u043c \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043a<\/span>\r\n    <span style=\"color: #8da6ce;\">int<\/span> posLevel <span style=\"color: #fbde2d;\">=<\/span> map(fht_log_out[posOffset[pos]], LOW_PASS, <span style=\"color: #8da6ce;\">gain<\/span>, <span style=\"color: #d8fa3c;\">0<\/span>, <span style=\"color: #d8fa3c;\">15<\/span>);\r\n    posLevel <span style=\"color: #fbde2d;\">=<\/span> constrain(posLevel, <span style=\"color: #d8fa3c;\">0<\/span>, <span style=\"color: #d8fa3c;\">15<\/span>);\r\n\r\n    <span style=\"color: #fbde2d;\">if<\/span> (posLevel &gt; <span style=\"color: #d8fa3c;\">7<\/span>) {               <span style=\"color: #aeaeae;\">\/\/ \u0435\u0441\u043b\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0431\u043e\u043b\u044c\u0448\u0435 7 (\u0437\u043d\u0430\u0447\u0438\u0442 \u043d\u0438\u0436\u043d\u0438\u0439 \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u0438\u043a \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u043b\u043d\u044b\u0439)<\/span>\r\n      lcd.write((uint8_t)posLevel <span style=\"color: #fbde2d;\">-<\/span> <span style=\"color: #d8fa3c;\">8<\/span>);    <span style=\"color: #aeaeae;\">\/\/ \u0432\u0435\u0440\u0445\u043d\u0438\u0439 \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u0438\u043a \u0437\u0430\u043b\u0438\u0442\u044c \u0442\u0435\u043c \u0447\u0442\u043e \u043e\u0441\u0442\u0430\u043b\u043e\u0441\u044c<\/span>\r\n      lcd.setCursor(pos, <span style=\"color: #d8fa3c;\">1<\/span>);          <span style=\"color: #aeaeae;\">\/\/ \u043f\u0435\u0440\u0435\u0439\u0442\u0438 \u043d\u0430 \u043d\u0438\u0436\u043d\u0438\u0439 \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u0438\u043a<\/span>\r\n      lcd.write((uint8_t)<span style=\"color: #d8fa3c;\">7<\/span>);        <span style=\"color: #aeaeae;\">\/\/ \u0437\u0430\u043b\u0438\u0442\u044c \u0435\u0433\u043e \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e<\/span>\r\n  } \r\n    <span style=\"color: #fbde2d;\">else<\/span> {                          <span style=\"color: #aeaeae;\">\/\/ \u0435\u0441\u043b\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043c\u0435\u043d\u044c\u0448\u0435 8<\/span>\r\n      lcd.<span style=\"color: #8da6ce;\">print<\/span>(<span style=\"color: #61ce3c;\">\" \"<\/span>);                 <span style=\"color: #aeaeae;\">\/\/ \u0432\u0435\u0440\u0445\u043d\u0438\u0439 \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u0438\u043a \u043f\u0443\u0441\u0442\u043e\u0439<\/span>\r\n      lcd.setCursor(pos, <span style=\"color: #d8fa3c;\">1<\/span>);          <span style=\"color: #aeaeae;\">\/\/ \u043d\u0438\u0436\u043d\u0438\u0439 \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u0438\u043a<\/span>\r\n      lcd.write((uint8_t)posLevel);        <span style=\"color: #aeaeae;\">\/\/ \u0437\u0430\u043b\u0438\u0442\u044c \u043f\u043e\u043b\u043e\u0441\u043a\u0430\u043c\u0438<\/span>\r\n   }\r\n  }  \r\n\r\n  <span style=\"color: #fbde2d;\">if<\/span> (AUTO_GAIN) {\r\n    maxValue_f <span style=\"color: #fbde2d;\">=<\/span> maxValue <span style=\"color: #fbde2d;\">*<\/span> k <span style=\"color: #fbde2d;\">+<\/span> maxValue_f <span style=\"color: #fbde2d;\">*<\/span> (<span style=\"color: #d8fa3c;\">1<\/span> <span style=\"color: #fbde2d;\">-<\/span> k);\r\n    <span style=\"color: #fbde2d;\">if<\/span> (millis() <span style=\"color: #fbde2d;\">-<\/span> gainTimer &gt; <span style=\"color: #d8fa3c;\">1500<\/span>) {      <span style=\"color: #aeaeae;\">\/\/ \u043a\u0430\u0436\u0434\u044b\u0435 1500 \u043c\u0441<\/span>\r\n      <span style=\"color: #aeaeae;\">\/\/ \u0435\u0441\u043b\u0438 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0431\u043e\u043b\u044c\u0448\u0435 \u043f\u043e\u0440\u043e\u0433\u0430, \u0432\u0437\u044f\u0442\u044c \u0435\u0433\u043e \u043a\u0430\u043a \u043c\u0430\u043a\u0441\u0438\u043c\u0443\u043c \u0434\u043b\u044f \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f<\/span>\r\n      <span style=\"color: #fbde2d;\">if<\/span> (maxValue_f &gt; VOL_THR) <span style=\"color: #8da6ce;\">gain<\/span> <span style=\"color: #fbde2d;\">=<\/span> maxValue_f;\r\n\r\n      <span style=\"color: #aeaeae;\">\/\/ \u0435\u0441\u043b\u0438 \u043d\u0435\u0442, \u0442\u043e \u0432\u0437\u044f\u0442\u044c \u043f\u043e\u0440\u043e\u0433 \u043f\u043e\u0431\u043e\u043b\u044c\u0448\u0435, \u0447\u0442\u043e\u0431\u044b \u0448\u0443\u043c\u044b \u0432\u043e\u043e\u0431\u0449\u0435 \u043d\u0435 \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u043b\u0438<\/span>\r\n      <span style=\"color: #fbde2d;\">else<\/span> <span style=\"color: #8da6ce;\">gain<\/span> <span style=\"color: #fbde2d;\">=<\/span> <span style=\"color: #d8fa3c;\">100<\/span>;\r\n      gainTimer <span style=\"color: #fbde2d;\">=<\/span> millis();\r\n    }\r\n  }\r\n}\r\n\r\n<span style=\"color: #8da6ce;\">void<\/span> analyzeAudio() {\r\n  <span style=\"color: #fbde2d;\">for<\/span> (<span style=\"color: #8da6ce;\">int<\/span> i <span style=\"color: #fbde2d;\">=<\/span> <span style=\"color: #d8fa3c;\">0<\/span> ; i &lt; FHT_N ; i<span style=\"color: #fbde2d;\">+<\/span><span style=\"color: #fbde2d;\">+<\/span>) {\r\n    <span style=\"color: #8da6ce;\">int<\/span> sample <span style=\"color: #fbde2d;\">=<\/span> analogRead(A0);\r\n    fht_input[i] <span style=\"color: #fbde2d;\">=<\/span> sample; <span style=\"color: #aeaeae;\">\/\/ put real data into bins<\/span>\r\n  }\r\n  fht_window();  <span style=\"color: #aeaeae;\">\/\/ window the data for better frequency response<\/span>\r\n  fht_reorder(); <span style=\"color: #aeaeae;\">\/\/ reorder the data before doing the fht<\/span>\r\n  fht_run();     <span style=\"color: #aeaeae;\">\/\/ process the data in the fht<\/span>\r\n  fht_mag_log(); <span style=\"color: #aeaeae;\">\/\/ take the output of the fht<\/span>\r\n}\r\n<\/pre>\n<p style=\"text-align: center;\"><iframe loading=\"lazy\" src=\"https:\/\/www.youtube.com\/embed\/pwgbLUJOUAU?ecver=1\" width=\"560\" height=\"315\" frameborder=\"0\" allowfullscreen=\"allowfullscreen\"><\/iframe><\/p>\n<p>\u041e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u0441\u043a\u0435\u0442\u0447\u0430 &#8212;\u00a0<a href=\"http:\/\/forum.rcl-radio.ru\/viewtopic.php?id=51\">http:\/\/forum.rcl-radio.ru\/viewtopic.php?id=51<\/a><\/p>\n<hr \/>\n<p><a href=\"http:\/\/rcl-radio.ru\/wp-content\/uploads\/2018\/06\/Screenshot-13.12.2019-105538.png\" class=\"highslide-image\" onclick=\"return hs.expand(this);\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-67903\" src=\"http:\/\/rcl-radio.ru\/wp-content\/uploads\/2018\/06\/Screenshot-13.12.2019-105538.png\" alt=\"\" width=\"615\" height=\"310\" srcset=\"http:\/\/rcl-radio.ru\/wp-content\/uploads\/2018\/06\/Screenshot-13.12.2019-105538.png 884w, http:\/\/rcl-radio.ru\/wp-content\/uploads\/2018\/06\/Screenshot-13.12.2019-105538-200x101.png 200w, http:\/\/rcl-radio.ru\/wp-content\/uploads\/2018\/06\/Screenshot-13.12.2019-105538-500x252.png 500w, http:\/\/rcl-radio.ru\/wp-content\/uploads\/2018\/06\/Screenshot-13.12.2019-105538-768x387.png 768w\" sizes=\"auto, (max-width: 615px) 100vw, 615px\" \/><\/a><\/p>\n<p>5 \u0440\u0435\u0436\u0438\u043c\u043e\u0432 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043f\u043e\u043b\u043e\u0441, \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043a\u043d\u043e\u043f\u043a\u043e\u0439 D12 (10 \u041a \u043d\u0430 GND, \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 +5 \u0412). \u0421\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 \u0440\u0430\u0437\u0434\u0435\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u043a\u043e\u043d\u0434\u0435\u043d\u0441\u0430\u0442\u043e\u0440 0,1 \u043c\u043a\u0424.<\/p>\n<h3 class=\"hn\" style=\"text-align: center;\"><a href=\"http:\/\/forum.rcl-radio.ru\/viewtopic.php?id=104\">\u0424\u043e\u0440\u0443\u043c &#8212; \u0410\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440 \u0441\u043f\u0435\u043a\u0442\u0440\u0430 LCD2004<\/a><\/h3>\n","protected":false},"excerpt":{"rendered":"<p>\u0414\u043b\u044f \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430 \u0441\u043f\u0435\u043a\u0442\u0440\u0430 \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f Arduino Nano (Uno) \u0438 LCD \u0434\u0438\u0441\u043f\u043b\u0435\u0439 1602, \u043d\u0430 \u0431\u0430\u0437\u0435 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430 HD44780, \u0442\u0430\u043a \u0436\u0435 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 FHT.h. \u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0430 \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430 \u0441\u043f\u0435\u043a\u0442\u0440\u0430 \u0431\u044b\u043b \u0432\u044b\u0431\u0440\u0430\u043d \u043f\u0440\u043e\u0435\u043a\u0442 FHTSpectrumAnalyzer, \u0432 \u043a\u043e\u0434 \u0431\u044b\u043b\u0438 \u0432\u043d\u0435\u0441\u0435\u043d\u044b \u043d\u0435\u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f, \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0434\u0438\u0441\u043f\u043b\u0435\u044f \u043f\u043e\u00a0I2C \u0431\u044b\u043b\u043e \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u043e \u043d\u0430 4-\u0445 \u0431\u0438\u0442\u043d\u044b\u0439 \u0440\u0435\u0436\u0438\u043c, \u043e\u043f\u043e\u0440\u043d\u043e\u0435 \u043d\u0430\u043f\u0440\u044f\u0436\u0435\u043d\u0438\u0435 \u0410\u0426\u041f \u0431\u044b\u043b\u043e \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0435\u043d\u043e \u043d\u0430 \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0435\u0435 1,1 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":42904,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[239,17],"tags":[],"class_list":["post-42903","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-arduino","category-17"],"views":26293,"_links":{"self":[{"href":"http:\/\/rcl-radio.ru\/index.php?rest_route=\/wp\/v2\/posts\/42903","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=42903"}],"version-history":[{"count":8,"href":"http:\/\/rcl-radio.ru\/index.php?rest_route=\/wp\/v2\/posts\/42903\/revisions"}],"predecessor-version":[{"id":130332,"href":"http:\/\/rcl-radio.ru\/index.php?rest_route=\/wp\/v2\/posts\/42903\/revisions\/130332"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/rcl-radio.ru\/index.php?rest_route=\/wp\/v2\/media\/42904"}],"wp:attachment":[{"href":"http:\/\/rcl-radio.ru\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=42903"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/rcl-radio.ru\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=42903"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/rcl-radio.ru\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=42903"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}