/* * Task2 * * Write messages over the serial port * */ // Declare outside loop() so it can be used in both code blocks int n; void setup() { // initialize serial communication at 9600 bits per second: Serial.begin(9600); // Write something out to show we are alive Serial.println(F("Starting...")); // Initialize our variables n = 0; } void loop() { // Increment count, equivalent to n = n+1; n++; Serial.print(F("The loop has iterated ")); Serial.print(String(n)); if (n==1) { Serial.println(F(" time")); } else { Serial.println(F(" times")); } // Wait 1 second delay(1000); }