Robots Atlas>ROBOTS ATLAS

Arduino for Beginners · Sketch Programming Fundamentals

The Serial Monitor as a debugging tool

Sketch Programming Fundamentals

Introduction

Arduino has no screen and no step debugger like a big IDE — the only window into a running program is the serial port. This lesson covers the Serial library: initialization via Serial.begin(baud), printing values (print / println, DEC/HEX/BIN formats, float decimal places), reading data from the computer (available / read / readString / parseInt), and the practice of debugging by inserting prints. We also look at the hardware underneath: the UART in the ATmega328P, the TX/RX pins (0/1 on the Uno), garbage characters at the wrong baud rate, the impact of transmission on timing, the serial buffer, Serial.flush(), and the Serial Plotter.