// // Declare a variable for the LED pin
// int ledPin = 13;
// // The setup function runs once when you press reset or power the board
// void setup() {
// // Initialize the digital pin as an output for the LED.
// pinMode(ledPin, OUTPUT);
// // Initialize serial communication with a baud rate of 9600.
// Serial.begin(9600);
// }
// // The loop function runs over and over again forever
// void loop() {
// // Turn the LED on
// digitalWrite(ledPin, HIGH);
// // Wait for one second
// delay(1000);
// // Turn the LED off
// digitalWrite(ledPin, LOW);
// // Wait for one second
// delay(1000);
// // Send a message to the serial monitor on your computer
// Serial.println("LED is blinking");
// }
// Declare a variable for the LED pin
int ledPin = 13;
// Declare a variable to count the number of blinks
int blinkCount = 0;
// The setup function runs once when you press reset or power the board
void setup() {
// Initialize the digital pin as an output for the LED.
pinMode(ledPin, OUTPUT);
// Initialize serial communication with a baud rate of 9600.
Serial.begin(9600);
}
// The loop function runs over and over again forever
void loop() {
// Check if blinkCount is less than 15
if (blinkCount < 15) {
// Increment blinkCount
blinkCount++;
// Turn the LED on
digitalWrite(ledPin, HIGH);
// Wait for one second
delay(1000);
// Turn the LED off
digitalWrite(ledPin, LOW);
// Wait for one second
delay(1000);
// Send a message to the serial monitor on your computer
Serial.print("The LED blinked for the ");
Serial.print(blinkCount);
Serial.println("th time");
}
}
// int ledPin = 13;
// void setup()
// {
// pinMode(ledPin, OUTPUT);
// Serial.begin(9600);
// }
// int count = 0;
// void loop()
// {
// for(count = 1; count <= 15; count++)
// {
// // Turn the LED on
// digitalWrite(ledPin, HIGH);
// // Wait for one second
// delay(1000);
// // Turn the LED off
// digitalWrite(ledPin, LOW);
// // Wait for one second
// delay(1000);
// // Create a buffer to hold the formatted string
// char buffer[50];
// // Format the string
// sprintf(buffer, " %d Iteration complete", count);
// // Print the formatted string to the serial monitor
// Serial.println(buffer);
// }
// // You might want to stop the loop after 15 iterations to prevent it from restarting.
// while(1);
// }