{"id":52384,"date":"2026-11-01T10:51:05","date_gmt":"2026-11-01T10:51:05","guid":{"rendered":"http:\/\/siratek.net\/index.php\/tutorials\/using-the-serial-monitor\/"},"modified":"2026-11-01T10:51:05","modified_gmt":"2026-11-01T10:51:05","slug":"using-the-serial-monitor","status":"publish","type":"siratek_tutorial","link":"https:\/\/siratek.net\/index.php\/tutorials\/using-the-serial-monitor\/","title":{"rendered":"Seeing What Your Program Is Doing"},"content":{"rendered":"<body><p><\/p>\n<h2>What this covers<\/h2>\n<p>The Serial Monitor is the only window you have into a running sketch. A board gives no error message when something is wrong; it simply does the wrong thing quietly. Printing to serial is how you find out why.<\/p>\n<p>Learning this properly now means every later tutorial can be debugged instead of guessed at.<\/p>\n<h2>Before you begin<\/h2>\n<ul>\n<li>A board, a USB data cable, and the Arduino IDE.<\/li>\n<li>Nothing wired. Everything here uses the board alone.<\/li>\n<\/ul>\n<h2>Opening the link<\/h2>\n<p>Two things have to agree: the speed your sketch opens the link at, and the speed the Serial Monitor reads it at. Mismatched, you get a screen of meaningless symbols.<\/p>\n<pre><code>void setup() {\n  Serial.begin(9600);   \/\/ Opens the link at 9600 bits per second.\n  Serial.println(\"Ready.\");\n}\n\nvoid loop() {\n}<\/code><\/pre>\n<p>Upload this, then open <strong>Tools &gt; Serial Monitor<\/strong> and set the rate selector at the bottom of the window to <strong>9600 baud<\/strong>. You should see <code>Ready.<\/code> appear once.<\/p>\n<p>It appears once because <code>setup()<\/code> runs once. If you see it repeatedly, something is resetting the board.<\/p>\n<figure class=\"siratek-tutorial-figure\"><img decoding=\"async\" src=\"http:\/\/siratek.net\/wp-content\/uploads\/2026\/11\/using-the-serial-monitor-baud-rate.svg\" alt=\"The path from a sketch through the board's USB chip to the serial monitor, and what a baud mismatch looks like\" loading=\"lazy\"><figcaption>Rubbish on the screen almost never means a broken board. The two speeds do not match.<\/figcaption><\/figure>\n<h2>Printing values<\/h2>\n<p><code>Serial.print()<\/code> writes without moving to a new line. <code>Serial.println()<\/code> writes and then ends the line. Mixing them is how you build a readable line from several pieces.<\/p>\n<pre><code>int reading = 512;\n\nSerial.print(\"Sensor: \");\nSerial.print(reading);\nSerial.println(\" counts\");<\/code><\/pre>\n<p>That prints <code>Sensor: 512 counts<\/code> and ends the line.<\/p>\n<p>The useful habit is to label every value. A screen of bare numbers tells you nothing six lines later when two sensors are printing at once.<\/p>\n<pre><code>Serial.print(\"temp=\");\nSerial.print(temperature);\nSerial.print(\" humidity=\");\nSerial.println(humidity);<\/code><\/pre>\n<h2>Watching something change<\/h2>\n<p>This is the pattern you will use for the rest of the library: read something, print it, pause briefly so the output is readable.<\/p>\n<pre><code>\/\/ Siratek: watching a value change over time.\n\nvoid setup() {\n  Serial.begin(9600);\n  Serial.println(\"Siratek: starting.\");\n}\n\nvoid loop() {\n  int reading = analogRead(A0);   \/\/ Nothing connected yet, so this will drift.\n\n  Serial.print(\"A0 = \");\n  Serial.println(reading);\n\n  delay(500);\n}<\/code><\/pre>\n<p>With nothing wired to <code>A0<\/code>, the numbers will wander unpredictably. That is correct, and it is worth seeing: an input pin with nothing connected has no defined voltage to measure, so it reports noise. A reading that drifts like this in a real project usually means a wire has come off.<\/p>\n<h2>Printing costs time<\/h2>\n<p>Serial output is slow compared to everything else the chip does. At 9600 baud a single character takes about a millisecond, so a line of forty characters holds the program up for roughly four milliseconds.<\/p>\n<p>That does not matter when you print twice a second. It matters a great deal inside a loop that needs to run quickly, where printing can be the reason the timing looks wrong. If adding a print statement changes the behaviour you were investigating, the printing itself is now part of the problem.<\/p>\n<p>Raising the rate to 115200 in both the sketch and the Serial Monitor makes output roughly twelve times faster, which is the usual answer.<\/p>\n<h2>Finding a fault with it<\/h2>\n<p>When something does not work, the question is always the same: is the program doing what I think, and is the hardware doing what the program says?<\/p>\n<p>Printing answers the first half. Put a print at each step and watch which ones appear.<\/p>\n<pre><code>void loop() {\n  Serial.println(\"1: about to read\");\n  int value = analogRead(A0);\n\n  Serial.print(\"2: read \");\n  Serial.println(value);\n\n  if (value &gt; 500) {\n    Serial.println(\"3: above threshold\");\n    digitalWrite(ledPin, HIGH);\n  }\n\n  delay(500);\n}<\/code><\/pre>\n<p>If <code>3:<\/code> never appears, the threshold is never crossed and the wiring is the place to look. If it appears and the LED stays dark, the program is right and the fault is after it. That single distinction is most of debugging.<\/p>\n<h2>Keep <code>D0<\/code> and <code>D1<\/code> clear<\/h2>\n<p>The USB serial connection uses digital pins <code>0<\/code> and <code>1<\/code>. Anything else wired to them fights with it, which shows up as missing output, corrupted output, or uploads that fail.<\/p>\n<p>Leave those two pins alone while you are using the Serial Monitor.<\/p>\n<h2>Check yourself<\/h2>\n<ol>\n<li>You see <code>\u00e2\u00f1\u00bf@<\/code> instead of words. What is wrong?<\/li>\n<li><code>Ready.<\/code> prints over and over instead of once. What does that suggest?<\/li>\n<li>You add a print inside a fast loop and the timing changes. Why?<\/li>\n<li>Your print appears but the LED does not light. Which half of the problem is ruled out?<\/li>\n<\/ol>\n<h2>Troubleshooting<\/h2>\n<table>\n<thead>\n<tr>\n<th>Symptom<\/th>\n<th>Likely cause<\/th>\n<th>Check or fix<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>Symbols instead of text<\/td>\n<td>Rate mismatch<\/td>\n<td>Make <code>Serial.begin()<\/code> and the Serial Monitor agree<\/td>\n<\/tr>\n<tr>\n<td>Nothing at all<\/td>\n<td>No <code>Serial.begin()<\/code>, or wrong port<\/td>\n<td>Add it to <code>setup()<\/code>, then check <strong>Tools &gt; Port<\/strong><\/td>\n<\/tr>\n<tr>\n<td>Output stops after a while<\/td>\n<td>Board resetting, or a crash<\/td>\n<td>Print at the top of <code>setup()<\/code> to see if it restarts<\/td>\n<\/tr>\n<tr>\n<td>Upload fails with the monitor open<\/td>\n<td>Port already in use<\/td>\n<td>Close the Serial Monitor and upload again<\/td>\n<\/tr>\n<tr>\n<td>Text appears twice<\/td>\n<td>Printing in both <code>setup()<\/code> and <code>loop()<\/code><\/td>\n<td>Check which one you meant<\/td>\n<\/tr>\n<tr>\n<td>Output garbled only sometimes<\/td>\n<td>Something wired to <code>D0<\/code> or <code>D1<\/code><\/td>\n<td>Move it to another pin<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2>Next steps<\/h2>\n<ul>\n<li><strong>Easier first:<\/strong> <em>How an Arduino Actually Works<\/em>.<\/li>\n<li><strong>Next:<\/strong> <em>Read a Potentiometer<\/em>, the first tutorial where serial output shows a real value changing.<\/li>\n<li><strong>Later:<\/strong> <em>Troubleshooting by Symptom<\/em>, which builds on this habit.<\/li>\n<\/ul>\n<h2>Sources and attribution<\/h2>\n<p>All text and code in this tutorial are original Siratek work.<\/p>\n<ul>\n<li>Arduino core documentation for the <code>Serial<\/code> functions.<\/li>\n<\/ul>\n<p>No third-party tutorial text, diagrams, photographs or code has been reproduced here.<\/p>\n<p><\/p>\n<\/body>","protected":false},"excerpt":{"rendered":"<p>The Serial Monitor is the only window you have into a running sketch. A board gives no error message when something is wrong; it simply does the wrong thing quietly. Printing to serial is how you find out why.<\/p>\n","protected":false},"featured_media":0,"template":"","siratek_tutorial_level":[],"class_list":["post-52384","siratek_tutorial","type-siratek_tutorial","status-publish","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.8 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Seeing What Your Program Is Doing - siratek<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"http:\/\/siratek.net\/index.php\/tutorials\/using-the-serial-monitor\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Seeing What Your Program Is Doing - siratek\" \/>\n<meta property=\"og:description\" content=\"The Serial Monitor is the only window you have into a running sketch. A board gives no error message when something is wrong; it simply does the wrong thing quietly. Printing to serial is how you find out why.\" \/>\n<meta property=\"og:url\" content=\"http:\/\/siratek.net\/index.php\/tutorials\/using-the-serial-monitor\/\" \/>\n<meta property=\"og:site_name\" content=\"siratek\" \/>\n<meta property=\"og:image\" content=\"http:\/\/siratek.net\/wp-content\/uploads\/2026\/11\/using-the-serial-monitor-baud-rate.svg\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"http:\\\/\\\/siratek.net\\\/index.php\\\/tutorials\\\/using-the-serial-monitor\\\/\",\"url\":\"http:\\\/\\\/siratek.net\\\/index.php\\\/tutorials\\\/using-the-serial-monitor\\\/\",\"name\":\"Seeing What Your Program Is Doing - siratek\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/siratek.net\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"http:\\\/\\\/siratek.net\\\/index.php\\\/tutorials\\\/using-the-serial-monitor\\\/#primaryimage\"},\"image\":{\"@id\":\"http:\\\/\\\/siratek.net\\\/index.php\\\/tutorials\\\/using-the-serial-monitor\\\/#primaryimage\"},\"thumbnailUrl\":\"http:\\\/\\\/siratek.net\\\/wp-content\\\/uploads\\\/2026\\\/11\\\/using-the-serial-monitor-baud-rate.svg\",\"datePublished\":\"2026-11-01T10:51:05+00:00\",\"breadcrumb\":{\"@id\":\"http:\\\/\\\/siratek.net\\\/index.php\\\/tutorials\\\/using-the-serial-monitor\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"http:\\\/\\\/siratek.net\\\/index.php\\\/tutorials\\\/using-the-serial-monitor\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"http:\\\/\\\/siratek.net\\\/index.php\\\/tutorials\\\/using-the-serial-monitor\\\/#primaryimage\",\"url\":\"https:\\\/\\\/siratek.net\\\/wp-content\\\/uploads\\\/2026\\\/11\\\/using-the-serial-monitor-baud-rate.svg\",\"contentUrl\":\"https:\\\/\\\/siratek.net\\\/wp-content\\\/uploads\\\/2026\\\/11\\\/using-the-serial-monitor-baud-rate.svg\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"http:\\\/\\\/siratek.net\\\/index.php\\\/tutorials\\\/using-the-serial-monitor\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/siratek.net\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Tutorials\",\"item\":\"https:\\\/\\\/siratek.net\\\/index.php\\\/tutorials\\\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Seeing What Your Program Is Doing\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/siratek.net\\\/#website\",\"url\":\"https:\\\/\\\/siratek.net\\\/\",\"name\":\"siratek\",\"description\":\"Your Best Electronic Retail Shop\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/siratek.net\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Seeing What Your Program Is Doing - siratek","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"http:\/\/siratek.net\/index.php\/tutorials\/using-the-serial-monitor\/","og_locale":"en_US","og_type":"article","og_title":"Seeing What Your Program Is Doing - siratek","og_description":"The Serial Monitor is the only window you have into a running sketch. A board gives no error message when something is wrong; it simply does the wrong thing quietly. Printing to serial is how you find out why.","og_url":"http:\/\/siratek.net\/index.php\/tutorials\/using-the-serial-monitor\/","og_site_name":"siratek","og_image":[{"url":"http:\/\/siratek.net\/wp-content\/uploads\/2026\/11\/using-the-serial-monitor-baud-rate.svg","type":"","width":"","height":""}],"twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"http:\/\/siratek.net\/index.php\/tutorials\/using-the-serial-monitor\/","url":"http:\/\/siratek.net\/index.php\/tutorials\/using-the-serial-monitor\/","name":"Seeing What Your Program Is Doing - siratek","isPartOf":{"@id":"https:\/\/siratek.net\/#website"},"primaryImageOfPage":{"@id":"http:\/\/siratek.net\/index.php\/tutorials\/using-the-serial-monitor\/#primaryimage"},"image":{"@id":"http:\/\/siratek.net\/index.php\/tutorials\/using-the-serial-monitor\/#primaryimage"},"thumbnailUrl":"http:\/\/siratek.net\/wp-content\/uploads\/2026\/11\/using-the-serial-monitor-baud-rate.svg","datePublished":"2026-11-01T10:51:05+00:00","breadcrumb":{"@id":"http:\/\/siratek.net\/index.php\/tutorials\/using-the-serial-monitor\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["http:\/\/siratek.net\/index.php\/tutorials\/using-the-serial-monitor\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"http:\/\/siratek.net\/index.php\/tutorials\/using-the-serial-monitor\/#primaryimage","url":"https:\/\/siratek.net\/wp-content\/uploads\/2026\/11\/using-the-serial-monitor-baud-rate.svg","contentUrl":"https:\/\/siratek.net\/wp-content\/uploads\/2026\/11\/using-the-serial-monitor-baud-rate.svg"},{"@type":"BreadcrumbList","@id":"http:\/\/siratek.net\/index.php\/tutorials\/using-the-serial-monitor\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/siratek.net\/"},{"@type":"ListItem","position":2,"name":"Tutorials","item":"https:\/\/siratek.net\/index.php\/tutorials\/"},{"@type":"ListItem","position":3,"name":"Seeing What Your Program Is Doing"}]},{"@type":"WebSite","@id":"https:\/\/siratek.net\/#website","url":"https:\/\/siratek.net\/","name":"siratek","description":"Your Best Electronic Retail Shop","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/siratek.net\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"}]}},"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/siratek.net\/index.php\/wp-json\/wp\/v2\/siratek_tutorial\/52384","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/siratek.net\/index.php\/wp-json\/wp\/v2\/siratek_tutorial"}],"about":[{"href":"https:\/\/siratek.net\/index.php\/wp-json\/wp\/v2\/types\/siratek_tutorial"}],"version-history":[{"count":0,"href":"https:\/\/siratek.net\/index.php\/wp-json\/wp\/v2\/siratek_tutorial\/52384\/revisions"}],"wp:attachment":[{"href":"https:\/\/siratek.net\/index.php\/wp-json\/wp\/v2\/media?parent=52384"}],"wp:term":[{"taxonomy":"siratek_tutorial_level","embeddable":true,"href":"https:\/\/siratek.net\/index.php\/wp-json\/wp\/v2\/siratek_tutorial_level?post=52384"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}