Newer
Older
Hardware / FaultInjection / examples / FaultyCat / 01_simple_restart / example_v1.2_pretty.ino
0xRoM on 11 Feb 994 bytes initial commit
  1. #include <SoftwareSerial.h>
  2.  
  3. #define RX 3 // *** D3, Pin 2
  4. #define TX 4 // *** D4, Pin 3
  5. SoftwareSerial Serial(RX, TX);
  6.  
  7. void setup() {
  8. Serial.begin(9600);
  9. Serial.println(" ");
  10. Serial.println("Initializing...");
  11. delay(2000); // Delay to give time for the setup message
  12. }
  13.  
  14. void loop() {
  15. static int dotCount = 0; // Keeps track of how many dots are printed
  16. // Create the base "running" message followed by spaces to clear previous dots
  17. Serial.print("running");
  18. // Add the appropriate number of dots
  19. for (int i = 0; i < dotCount; i++) {
  20. Serial.print(".");
  21. }
  22. // Clear any extra dots from previous loops by adding spaces
  23. for (int i = dotCount; i < 3; i++) {
  24. Serial.print(" ");
  25. }
  26. // Use carriage return to overwrite the line on the next iteration
  27. Serial.print("\r");
  28.  
  29. // Update the dot count, cycling from 0 to 3
  30. dotCount = (dotCount + 1) % 4; // Cycles through 0, 1, 2, 3 dots
  31. delay(1000); // 1-second delay before updating
  32. }
Buy Me A Coffee