Newer
Older
Hardware / FaultInjection / examples / FaultyCat / 01_simple_restart / example_v1.2_pretty.ino
0xRoM on 11 Feb 994 bytes initial commit
#include <SoftwareSerial.h>

#define RX    3   // *** D3, Pin 2
#define TX    4   // *** D4, Pin 3
SoftwareSerial Serial(RX, TX);

void setup() {
  Serial.begin(9600);
  Serial.println(" ");
  Serial.println("Initializing...");
  delay(2000);  // Delay to give time for the setup message
}

void loop() {
  static int dotCount = 0;  // Keeps track of how many dots are printed
  
  // Create the base "running" message followed by spaces to clear previous dots
  Serial.print("running");
  
  // Add the appropriate number of dots
  for (int i = 0; i < dotCount; i++) {
    Serial.print(".");
  }
  
  // Clear any extra dots from previous loops by adding spaces
  for (int i = dotCount; i < 3; i++) {
    Serial.print(" ");
  }
  
  // Use carriage return to overwrite the line on the next iteration
  Serial.print("\r");

  // Update the dot count, cycling from 0 to 3
  dotCount = (dotCount + 1) % 4;  // Cycles through 0, 1, 2, 3 dots
  
  delay(1000);  // 1-second delay before updating
}