Arduino C++
// Define necessary pins
const int ledPin = 26;
const int buttonPin = 27;

// Variable
int counter = 0;

void setup() {
  // Initialize pins
  pinMode(ledPin, OUTPUT);
  pinMode(buttonPin, INPUT_PULLDOWN);
  Serial.begin(9600);
}

void loop() {
  if (digitalRead(buttonPin) == HIGH) {
    digitalWrite(ledPin, HIGH);
    counter++;
    Serial.println(counter);
    delay(500);
  } else {
    digitalWrite(ledPin, LOW);
  }

  if (counter == 3) {
    Serial.println("Hello World");
    counter = 0;
  }
}