{"id":640,"date":"2022-11-22T23:46:21","date_gmt":"2022-11-22T15:46:21","guid":{"rendered":"http:\/\/wordpress.loc\/?p=640"},"modified":"2022-11-22T23:47:23","modified_gmt":"2022-11-22T15:47:23","slug":"esp32_ch4","status":"publish","type":"post","link":"https:\/\/www.nmking.io\/index.php\/2022\/11\/22\/640\/","title":{"rendered":"ESP32\u4f7f\u7528Softwareserial.h\u554f\u984c"},"content":{"rendered":"\n<figure class=\"wp-block-pullquote\"><blockquote><p>This is a great solution about using Softwareserial.h in ESP32 board. There is an error &#8220;fatal error: avr\/interrupt.h: No such file or directory&#8221; in softwareserial.cpp when you compiler the code.<\/p><\/blockquote><\/figure>\n\n\n\n<div style=\"height:100px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p>This is a great solution about using Softwareserial.h in ESP32 board. There is an error &#8220;fatal error: avr\/interrupt.h: No such file or directory&#8221; in softwareserial.cpp when you compiler the code. if you have the same problem, fellow the instructions:<\/p>\n\n\n\n<p>1.download espsoftwareserial library on github: <a href=\"https:\/\/github.com\/jdollar\/espsoftwareserial\/\">https:\/\/github.com\/jdollar\/espsoftwareserial\/<\/a><\/p>\n\n\n\n<p>2.modify softwareserial.cpp code, see post <a rel=\"noreferrer noopener\" href=\"https:\/\/www.reddit.com\/\u2026\/softwareserial_working_for_esp32a\u2026\/\" target=\"_blank\">https:\/\/www.reddit.com\/\u2026\/softwareserial_working_fo<\/a><a rel=\"noreferrer noopener\" href=\"https:\/\/www.reddit.com\/r\/hackerboxes\/comments\/5xba6g\/softwareserial_working_for_esp32arduino_ide\/\" target=\"_blank\">r_esp32a\u2026\/<\/a> \u3000<\/p>\n\n\n\n<p>2.1)<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>extern \"C\" { #include \"esp32-hal-gpio.h\" } \u3000<\/code><\/pre>\n\n\n\n<p>2.2)add these codes below #define MAX_PIN 15<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ifdef ICACHE_FLASH\n\ndefine ICACHE_FLASH_ATTR attribute((section(\".irom0.text\")))\n\ndefine ICACHE_RAM_ATTR attribute((section(\".iram.text\")))\n\ndefine ICACHE_RODATA_ATTR attribute((section(\".irom.text\")))\n\nelse\n\ndefine ICACHE_FLASH_ATTR\n\ndefine ICACHE_RAM_ATTR\n\ndefine ICACHE_RODATA_ATTR\n\nendif \/* ICACHE_FLASH *\/\n\ndefine GPIO_STATUS_W1TC_ADDRESS 0x24<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p>Ok that&#8217;s all, enjoy it.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This is a great solution about using Softwareserial.h i [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[1],"tags":[],"class_list":["post-640","post","type-post","status-publish","format-standard","hentry","category-esp32"],"blocksy_meta":[],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack-related-posts":[],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.nmking.io\/index.php\/wp-json\/wp\/v2\/posts\/640","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.nmking.io\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.nmking.io\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.nmking.io\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.nmking.io\/index.php\/wp-json\/wp\/v2\/comments?post=640"}],"version-history":[{"count":1,"href":"https:\/\/www.nmking.io\/index.php\/wp-json\/wp\/v2\/posts\/640\/revisions"}],"predecessor-version":[{"id":641,"href":"https:\/\/www.nmking.io\/index.php\/wp-json\/wp\/v2\/posts\/640\/revisions\/641"}],"wp:attachment":[{"href":"https:\/\/www.nmking.io\/index.php\/wp-json\/wp\/v2\/media?parent=640"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.nmking.io\/index.php\/wp-json\/wp\/v2\/categories?post=640"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.nmking.io\/index.php\/wp-json\/wp\/v2\/tags?post=640"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}