[examples] Add PinScan example

This commit is contained in:
Kuba Szczodrzyński
2022-07-31 23:25:40 +02:00
parent 5d00ddf516
commit 3601fa63d8
10 changed files with 727 additions and 0 deletions

View File

@@ -0,0 +1,37 @@
/* Copyright (c) Kuba Szczodrzyński 2022-07-31. */
#include "main.h"
bool ansi = true;
bool ansiSkipErase = false;
void printAnsi(const char *str) {
if (ansi)
stream->print(str);
}
void printAnsiErase() {
if (!ansiSkipErase)
printAnsi(ANSI_ERASE ANSI_HOME);
ansiSkipErase = false;
}
void line() {
stream->print("--------");
if (output == -1) {
stream->print("TELNET");
} else {
stream->print(" UART");
stream->print(output);
stream->write(' ');
}
stream->print("--------");
stream->println();
}
int inputPin() {
stream->print("Enter pin number: ");
int pin = stream->parseInt();
stream->println();
return pin;
}