void output() {
VGAX vga;
Serial.println("Start");
boolean button = false;
boolean output = true;
vga.begin();
while (output) {
char stri[10];
static const char str[] PROGMEM = "Move on";
static const char str0[] PROGMEM = "X = ";
static const char str1[] PROGMEM = "Y = ";
static const char str2[] PROGMEM = "Tact = ";
static const char str3[] PROGMEM = "Yoke = ";
double a1 = (analogRead (A1) / 10) - 51;
double a2 = (analogRead (A2) / 10) - 51;
int a3 = analogRead (A5) / 10;
xVa += map(a1, -51, 51, -a3, a3) / 100.0;
yVa += map(a2, -51, 51, -a3, a3) / 100.0;
if ((a1 != 0) || (a2 != 0) || (a3_copi != a3)) {
a3_copi = a3;
vga.clear(BLACK);
vga.printPROGMEM((byte*)fnt_nanofont_data, FNT_NANOFONT_SYMBOLS_COUNT, FNT_NANOFONT_HEIGHT, 3, 1, str, 10, 0, RED);
vga.printPROGMEM((byte*)fnt_nanofont_data, FNT_NANOFONT_SYMBOLS_COUNT, FNT_NANOFONT_HEIGHT, 3, 1, str0, 10, 10, RED);
dtostrf(xVa, 3, 2, stri);
vgaPrint(stri, 30, 10, RED, vga);
vga.printPROGMEM((byte*)fnt_nanofont_data, FNT_NANOFONT_SYMBOLS_COUNT, FNT_NANOFONT_HEIGHT, 3, 1, str1, 10, 20, RED);
dtostrf(yVa, 3, 2, stri);
vgaPrint(stri, 30, 20, RED, vga);
vga.printPROGMEM((byte*)fnt_nanofont_data, FNT_NANOFONT_SYMBOLS_COUNT, FNT_NANOFONT_HEIGHT, 3, 1, str2, 60, 0, GREEN);
dtostrf(a3, 3, 2, stri);
vgaPrint(stri, 90, 0, GREEN, vga);
vga.printPROGMEM((byte*)fnt_nanofont_data, FNT_NANOFONT_SYMBOLS_COUNT, FNT_NANOFONT_HEIGHT, 3, 1, str3, 60, 10, GREEN);
dtostrf(a1, 3, 2, stri);
vgaPrint(stri, 90, 10, GREEN, vga);
dtostrf(a2, 3, 2, stri);
vgaPrint(stri, 90, 20, GREEN, vga);
button = true;
} else {
if (button) {
vga.clear(BLACK);
vga.printPROGMEM((byte*)fnt_nanofont_data, FNT_NANOFONT_SYMBOLS_COUNT, FNT_NANOFONT_HEIGHT, 3, 1, str, 10, 0, RED);
vga.printPROGMEM((byte*)fnt_nanofont_data, FNT_NANOFONT_SYMBOLS_COUNT, FNT_NANOFONT_HEIGHT, 3, 1, str0, 10, 10, RED);
dtostrf(xVa, 3, 2, stri);
vgaPrint(stri, 30, 10, RED, vga);
vga.printPROGMEM((byte*)fnt_nanofont_data, FNT_NANOFONT_SYMBOLS_COUNT, FNT_NANOFONT_HEIGHT, 3, 1, str1, 10, 20, RED);
dtostrf(yVa, 3, 2, stri);
vgaPrint(stri, 30, 20, RED, vga);
vga.printPROGMEM((byte*)fnt_nanofont_data, FNT_NANOFONT_SYMBOLS_COUNT, FNT_NANOFONT_HEIGHT, 3, 1, str2, 60, 0, GREEN);
dtostrf(a3, 3, 2, stri);
vgaPrint(stri, 90, 0, GREEN, vga);
vga.printPROGMEM((byte*)fnt_nanofont_data, FNT_NANOFONT_SYMBOLS_COUNT, FNT_NANOFONT_HEIGHT, 3, 1, str3, 60, 10, GREEN);
dtostrf(a1, 3, 2, stri);
vgaPrint(stri, 90, 10, GREEN, vga);
dtostrf(a2, 3, 2, stri);
vgaPrint(stri, 90, 20, GREEN, vga);
vga.delay(100);
dtostrf(0, 3, 2, stri);
vgaPrint(stri, 90, 10, GREEN, vga);
dtostrf(0, 3, 2, stri);
vgaPrint(stri, 90, 20, GREEN, vga);
button = false;
}
}
if (digitalRead(0) == LOW) {
static const char str0[] PROGMEM = "start";
vga.printPROGMEM((byte*)fnt_nanofont_data, FNT_NANOFONT_SYMBOLS_COUNT, FNT_NANOFONT_HEIGHT, 3, 1, str0, 0, 0, GREEN);
delay(5000);
vga.end();
output = false;
}
vga.delay(100);
}
}
void vgaPrint(char * str, byte x, byte y, byte color, VGAX vga) {
vga.printSRAM((byte*)fnt_nanofont_data, FNT_NANOFONT_SYMBOLS_COUNT, FNT_NANOFONT_HEIGHT, 3, 1, str, x, y, color);
}