#include "ansi.h"
ANSI ansi(&Serial);
void setup() {
Serial.begin(9600);
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);
}