{"id":29394,"date":"2021-04-05T18:13:47","date_gmt":"2021-04-05T16:13:47","guid":{"rendered":"http:\/\/alessandrobuzzi.com\/?p=29394"},"modified":"2021-04-05T18:13:47","modified_gmt":"2021-04-05T16:13:47","slug":"ir-remote-v3","status":"publish","type":"post","link":"https:\/\/alessandrobuzzi.com\/?p=29394","title":{"rendered":"IR.remote v3"},"content":{"rendered":"\n<pre class=\"wp-block-syntaxhighlighter-code\">\/*\n * test libreria IR v3 funzionante\n * \n *\/\n\n\n#define DECODE_HASH         \/\/ special decoder for all protocols\n\n#include &lt;Arduino.h>\n\n\/*\n * Define macros for input and output pin etc.\n *\/\n#define IR_RECEIVE_PIN      7\n\n#include &lt;IRremote.h>\n\nvoid setup() {\n    Serial.begin(115200);\n    \/\/ Just to know which program is running on my Arduino\n    Serial.println(F(\"START \" __FILE__ \" from \" __DATE__ \"\\r\\nUsing library version \" VERSION_IRREMOTE));\n\n    \/*\n     * Start the receiver, enable feedback LED and take LED feedback pin from the internal boards definition\n     *\/\n    IrReceiver.begin(IR_RECEIVE_PIN, ENABLE_LED_FEEDBACK, USE_DEFAULT_FEEDBACK_LED_PIN);\n\n    Serial.print(F(\"Ready to receive IR signals at pin \"));\n    Serial.println(IR_RECEIVE_PIN);\n}\n\nvoid loop() {\n    \/*\n     * Check if received data is available and if yes, try to decode it.\n     * Decoded result is in the IrReceiver.decodedIRData structure.\n     *\n     * E.g. command is in IrReceiver.decodedIRData.command\n     * address is in command is in IrReceiver.decodedIRData.address\n     * and up to 32 bit raw data in IrReceiver.decodedIRData.decodedRawData\n     *\/\n    if (IrReceiver.decode()) {\n\n        \/\/ Print a short summary of received data\n        IrReceiver.printIRResultShort(&amp;Serial);\n        if (IrReceiver.decodedIRData.protocol == UNKNOWN) {\n            \/\/ We have an unknown protocol here, print more info\n            IrReceiver.printIRResultRawFormatted(&amp;Serial, true);\n        }\n        Serial.println();\n\n        \/*\n         * !!!Important!!! Enable receiving of the next value,\n         * since receiving has stopped after the end of the current received data packet.\n         *\/\n        IrReceiver.resume(); \/\/ Enable receiving of the next value\n\n        \/*\n         * Finally, check the received data and perform actions according to the received command\n         *\/\n        if (IrReceiver.decodedIRData.command == 0x10) {\n            \/\/ do something\n        } else if (IrReceiver.decodedIRData.command == 0x11) {\n            \/\/ do something else\n        }\n    }\n}<\/pre>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[5],"tags":[],"class_list":["post-29394","post","type-post","status-publish","format-standard","hentry","category-non-categorizzato"],"acf":[],"_links":{"self":[{"href":"https:\/\/alessandrobuzzi.com\/index.php?rest_route=\/wp\/v2\/posts\/29394","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/alessandrobuzzi.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/alessandrobuzzi.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/alessandrobuzzi.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/alessandrobuzzi.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=29394"}],"version-history":[{"count":0,"href":"https:\/\/alessandrobuzzi.com\/index.php?rest_route=\/wp\/v2\/posts\/29394\/revisions"}],"wp:attachment":[{"href":"https:\/\/alessandrobuzzi.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=29394"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/alessandrobuzzi.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=29394"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/alessandrobuzzi.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=29394"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}