// Serial_Debugging // Using serial.println to debug your code // // Arduino can talk back to the computer with information // about itself using serial communications. This can be really // handy for debugging your code by checking the value of certain // variable while the Arduino is running. // Set variables int myVariable = 0; // Setup void setup() { //"Serial.begin(somenumber)" tells the Arduino to start using serial // communications. You have to tell it what "baud" rate to use. // "baud" (named after Emile Baudot, a pioneer in telecommuncations // from the 19th century) is the speed at which the data flows over // pins 0 and 1 between the Arduino board and the Arduino application. // The baud rates must match each other to work. You set the baud rate // in the Arduino application by clicking on the Serial Monitor button // in the top menu in the application window and chosing the rate // from the popup menu in the lower left of this screen. 9600 is a // mid-range speed and is pretty reliable. Serial.begin(9600); } // Loop void loop() { //"Serial.print" and "Serial.println" tells the Arduino board to send // the value of whatever is in its parenthesis to the Arduino application. //"Serial.println" is like "Serial.print" except it adds a "line" // each time its called. Serial.print("The value of myVariable is: "); Serial.println(myVariable); myVariable = myVariable + 1; }