/**
Text with ANSI colors in the Serial Terminal, using Arduino's ANSI library.
See "diagram.json" for an example how to configure the Serial Terminal.
https://wokwi.com/arduino/projects/308893120796295745
Copyright (c) 2021 Uri Shaked
*/
#include "ansi.h"
ANSI ansi(&Serial);
void setup() {
Serial.begin(115200);
Serial.println("Hello, I'm in a terminal!");
Serial.println();
ansi.foreground(ANSI::white | ANSI::bright);
ansi.background(ANSI::red);
ansi.print(" Red ");
ansi.background(ANSI::green);
ansi.print(" Green ");
ansi.background(ANSI::magenta);
ansi.println(" Purple ");
Serial.println();
ansi.normal();
ansi.print("Doing nothing... ");
ansi.foreground(ANSI::yellow | ANSI::bright);
ansi.print("[ ]");
ansi.cursorBack(2);
}
const char *loopChars = "-\\|/";
int i;
void loop() {
ansi.print(loopChars[i]);
ansi.cursorBack(1);
i++;
if (strlen(loopChars) == i) {
i = 0;
}
delay(100);
}