{"id":901,"date":"2026-03-26T16:39:20","date_gmt":"2026-03-26T16:39:20","guid":{"rendered":"https:\/\/arduino-developer.com\/arduino\/?p=901"},"modified":"2026-03-26T16:39:20","modified_gmt":"2026-03-26T16:39:20","slug":"neoswserial-library","status":"publish","type":"post","link":"https:\/\/arduino-developer.com\/arduino\/programming\/uart\/neoswserial-library","title":{"rendered":"NeoSWSerial Library"},"content":{"rendered":"\n<p>Allows\u00a0normal IO pins to be used as bit bashed\u00a0UART pins. Pins used for RX must support interrupts, only 1 NeoSWSerial UART can receive at a time.<\/p>\n\n\n\n<p><em>NeoSWSerial is better that SoftwareSerial for reliability and and lower CPU impact. However, NeoSWSerial is limited to only 9600, 19200, 31250, and 38400 baud,<\/em><\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Resources<\/h4>\n\n\n\n<p><a rel=\"noreferrer noopener\" href=\"https:\/\/www.arduino.cc\/en\/Reference\/SoftwareSerial\" target=\"_blank\">https:\/\/www.arduino.cc\/en\/Reference\/SoftwareSerial<\/a><\/p>\n\n\n\n<p><a href=\"http:\/\/arduiniana.org\/libraries\/newsoftserial\/\">http:\/\/arduiniana.org\/libraries\/newsoftserial\/<\/a><\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Example Usage<\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code>#include &lt;NeoSWSerial.h>\n\nNeoSWSerial mySerial(8, 7); \/\/ RX=pin #, TX=pin #\n\nvoid audio_init (void)\n{\n  \/\/Set the baud rate for the NeoSWSerial port\n  mySerial.begin(9600);\n  mySerial.println(\"Hello, world?\");\n}\n\n\n\nvoid tx_packet (void)\n{\n  byte tx_data&#91;4];\n\n  mySerial.write(\"Hello\");\n\n  tx_data&#91;0] = 0x00;\n  tx_data&#91;1] = 0x01;\n  tx_data&#91;2] = 0x02;\n  tx_data&#91;3] = 0x03;\n  mySerial.write(&amp;tx_data&#91;0], 4);\n}<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">Receiving Data<\/h4>\n\n\n\n<p><em>Note you can define unlimited software serial ports, but only 1 can be set to receive at a time.<\/em><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>  \/\/Enable RX (will occur in background using irq's)\n  mySerial.listen();\n\n  \/\/....\n\n\n  while (mySerial.available() &gt; 0)\n  {\n    char data = mySerial.read();\n  }\n\n\/\/or:\n  char data = mySerial.read();\n  if (data != -1)\n  {\n    \/\/Byte received\n  }<\/code><\/pre>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Allows\u00a0normal IO pins to be used as bit bashed\u00a0UART pins. Pins used for RX must support interrupts, only 1 NeoSWSerial UART can receive at a time. NeoSWSerial is better that SoftwareSerial for reliability and and lower CPU impact. However, NeoSWSerial is limited to only 9600, 19200, 31250, and 38400 baud, Resources https:\/\/www.arduino.cc\/en\/Reference\/SoftwareSerial http:\/\/arduiniana.org\/libraries\/newsoftserial\/ Example Usage [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[19],"tags":[],"class_list":["post-901","post","type-post","status-publish","format-standard","hentry","category-uart"],"_links":{"self":[{"href":"https:\/\/arduino-developer.com\/arduino\/wp-json\/wp\/v2\/posts\/901","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/arduino-developer.com\/arduino\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/arduino-developer.com\/arduino\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/arduino-developer.com\/arduino\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/arduino-developer.com\/arduino\/wp-json\/wp\/v2\/comments?post=901"}],"version-history":[{"count":1,"href":"https:\/\/arduino-developer.com\/arduino\/wp-json\/wp\/v2\/posts\/901\/revisions"}],"predecessor-version":[{"id":902,"href":"https:\/\/arduino-developer.com\/arduino\/wp-json\/wp\/v2\/posts\/901\/revisions\/902"}],"wp:attachment":[{"href":"https:\/\/arduino-developer.com\/arduino\/wp-json\/wp\/v2\/media?parent=901"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/arduino-developer.com\/arduino\/wp-json\/wp\/v2\/categories?post=901"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/arduino-developer.com\/arduino\/wp-json\/wp\/v2\/tags?post=901"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}