{"id":1010,"date":"2017-01-27T14:45:57","date_gmt":"2017-01-27T14:45:57","guid":{"rendered":"http:\/\/easycoding.tn\/?page_id=1010"},"modified":"2017-12-13T15:21:56","modified_gmt":"2017-12-13T15:21:56","slug":"serial-2","status":"publish","type":"page","link":"http:\/\/easycoding.tn\/index.php\/nodemcu\/tuniot-documentation\/serial-2\/","title":{"rendered":"Serial"},"content":{"rendered":"<ul>\n<li><strong>Print format<\/strong><br \/>\nPrints data to the serial port as human-readable ASCII text.<br \/>\nFormat: specifies the number base (for integral data types) or number of decimal places (for floating point types)<br \/>\n<span style=\"color: #ff6600;\"><strong>Example<\/strong>: <\/span><span class=\"coMULTI\"><span style=\"color: #ff6600;\"> \u00a0<\/span>reads an analog input on analog in 0, prints the value out.<\/span><br \/>\n<img loading=\"lazy\" class=\"alignnone wp-image-1042\" src=\"http:\/\/easycoding.tn\/wp-content\/uploads\/2017\/01\/F-300x252.png\" alt=\"F\" width=\"229\" height=\"193\" srcset=\"http:\/\/easycoding.tn\/wp-content\/uploads\/2017\/01\/F-300x252.png 300w, http:\/\/easycoding.tn\/wp-content\/uploads\/2017\/01\/F.png 365w\" sizes=\"(max-width: 229px) 100vw, 229px\" \/><\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul>\n<li><strong>Serial read<img loading=\"lazy\" class=\" wp-image-1045 alignright\" src=\"http:\/\/easycoding.tn\/wp-content\/uploads\/2017\/01\/SerialRead2.png\" alt=\"SerialRead2\" width=\"116\" height=\"47\" \/><\/strong><br \/>\nReads incoming serial data.<br \/>\nReturns the first byte of incoming serial data available (or -1 if no data is available) &#8211; <em>int<\/em><\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul>\n<li><strong><img loading=\"lazy\" class=\"size-medium alignright\" src=\"http:\/\/easycoding.tn\/wp-content\/uploads\/2017\/12\/SerialAvailable.jpg\" width=\"154\" height=\"44\" \/>Serial available:<\/strong><br \/>\nGet the number of bytes (characters) available for reading from the serial port. This is data that&#8217;s already arrived and stored in the serial receive buffer (which holds 64 bytes).<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul>\n<li><strong><img loading=\"lazy\" class=\"size-medium alignright\" src=\"http:\/\/easycoding.tn\/wp-content\/uploads\/2017\/12\/PrintOnNewLine.jpg\" width=\"253\" height=\"47\" \/>Print on new line:<\/strong><br \/>\nPrints data to the serial port as human-readable ASCII text followed by a carriage return character (ASCII 13, or &#8216;\\r&#8217;) and a newline character (ASCII 10, or &#8216;\\n&#8217;). To view the output text, the serial baud rate should be set to 9600. This is a choice of TUNIOT to make thing easier.<br \/>\n<strong><span style=\"color: #ff6600;\">Example:<\/span> <\/strong>Showing the value of the photo-resistor on the serial monitor <a href=\"https:\/\/youtu.be\/8vWoKPQqXaU\">Video\u00a0<\/a><\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul>\n<li><strong><img loading=\"lazy\" class=\"size-medium alignright\" src=\"http:\/\/easycoding.tn\/wp-content\/uploads\/2017\/12\/SerialWrite.jpg\" width=\"184\" height=\"48\" \/>Serial Write:<\/strong><br \/>\nWrites binary data to the serial port. This data is sent as a byte or series of bytes; to send the characters representing the digits of a number use the print function instead.<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul>\n<li><strong><img loading=\"lazy\" class=\"size-medium alignright\" src=\"http:\/\/easycoding.tn\/wp-content\/uploads\/2017\/12\/SerialWriteReturn.jpg\" width=\"183\" height=\"61\" \/>Serial write (return): <\/strong><br \/>\nWill return the number of bytes written, though reading that number is optional.<br \/>\nReturn BYTE.<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul>\n<li><strong><img loading=\"lazy\" class=\"size-medium alignright\" src=\"http:\/\/easycoding.tn\/wp-content\/uploads\/2017\/12\/SerialFlash.jpg\" width=\"104\" height=\"41\" \/>Serial Flush:<\/strong><br \/>\nWaits for the transmission of outgoing serial data to complete.<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Print format Prints data to the serial port as human-readable ASCII text. Format: specifies the number base (for integral data&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":1007,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":[],"_links":{"self":[{"href":"http:\/\/easycoding.tn\/index.php\/wp-json\/wp\/v2\/pages\/1010"}],"collection":[{"href":"http:\/\/easycoding.tn\/index.php\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"http:\/\/easycoding.tn\/index.php\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"http:\/\/easycoding.tn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/easycoding.tn\/index.php\/wp-json\/wp\/v2\/comments?post=1010"}],"version-history":[{"count":14,"href":"http:\/\/easycoding.tn\/index.php\/wp-json\/wp\/v2\/pages\/1010\/revisions"}],"predecessor-version":[{"id":1460,"href":"http:\/\/easycoding.tn\/index.php\/wp-json\/wp\/v2\/pages\/1010\/revisions\/1460"}],"up":[{"embeddable":true,"href":"http:\/\/easycoding.tn\/index.php\/wp-json\/wp\/v2\/pages\/1007"}],"wp:attachment":[{"href":"http:\/\/easycoding.tn\/index.php\/wp-json\/wp\/v2\/media?parent=1010"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}