#include #include int coordx[] = {23, 23, 24, 24, 25, 26, 28, 30, 31, 34, 36, 38, 41, 44, 47, 50, 53, 56, 59, 62, 65, 68, 71, 74, 77, 80, 82, 84, 87, 88, 90, 92, 93, 94, 94, 95, 95}; int coordy[] = {78, 75, 72, 69, 66, 63, 60, 57, 55, 53, 50, 49, 47, 45, 44, 43, 43, 42, 42, 42, 43, 43, 44, 45, 47, 49, 50, 53, 55, 57, 60, 63, 66, 69, 72, 75, 78}; int coordix[] = {31, 35, 45, 59, 73, 83, 87}; int coordiy[] = {78, 64, 54, 50, 54, 64, 78}; TVout TV; void setup() { TV.begin(NTSC,120,96); TV.select_font(font8x8); } void loop() { float volt; uint8_t an, n; TV.clear_screen(); TV.println(23, 4, "Voltmeter"); TV.draw_circle(59, 78, 36, WHITE); for(int i=0; i<7; i++) TV.draw_line(coordx[i * 6], coordy[i * 6], coordix[i], coordiy[i], WHITE); an = analogRead(A0); volt = an / 1023.0 * 5.0; TV.print(39, 24, volt); TV.print('V'); n = 36 * an / 307; // 1023 ÷ 5 × 1.5 = 306.9 if(n > 36) n = 36; TV.draw_line(59, 78, coordx[n], coordy[n], WHITE); TV.delay(1000); }