#include <TVout.h>
#include <TVoutfonts/fontALL.h>
#include "schematic.h"
#include "TVOlogo.h"
TVout TV;
int zOff = 150;
int xOff = 0;
int yOff = 0;
int cSize = 50;
int view_plane = 64;
float angle = PI/60;
float cube3d[8][3] = {
{xOff - cSize,yOff + cSize,zOff - cSize},
{xOff + cSize,yOff + cSize,zOff - cSize},
{xOff - cSize,yOff - cSize,zOff - cSize},
{xOff + cSize,yOff - cSize,zOff - cSize},
{xOff - cSize,yOff + cSize,zOff + cSize},
{xOff + cSize,yOff + cSize,zOff + cSize},
{xOff - cSize,yOff - cSize,zOff + cSize},
{xOff + cSize,yOff - cSize,zOff + cSize}
};
unsigned char cube2d[8][2];
const int potPin = A0;
void setup() {
TV.begin(PAL,120,96);
}
void loop() {
// Read the potentiometer value
int potValue = analogRead(potPin);
// Convert the potentiometer value to distance (you may need to calibrate this)
int distance_cm = map(potValue, 0, 1023, -20, +20);
// Clear the display
TV.clear_screen();
TV.select_font(font8x8);
// Display the distance on the OLED
TV.println(15,0,"Forskydning:");
TV.print(35,50,distance_cm);
TV.println(" cm");
// Wait for a moment
delay(300);
}