for VGA Monitor 640 * 480
Code: [Local Link Removed for Guests]
'Annex32-S3 CAN DMT VGA 1.51.1 qio opi LFS
'VGA.PINOUT R0, R1, R2, G0, G1, G2, B0, B1, HSYNC, VSYNC
vga.pinout 12,13,14,18,8,3,5,6, 4,9
tft.loadfont "/fonts/FreeSansBold20pt7b.bin", 10
vga.delete
vga.init 2 ' VGA 640x480
'timer0 50, ticker
VGA.TEXT.COLOR white
vga.fill black
vga.text.size 2
do
FOR value = 90 to 270
pause 30
if value=270 then value=90
gosub L_meter
next value
loop
OPTION.WLOG 1
L_meter:'gauge
'VGA.RECT x, y, w, h, color [,fill]
vga.RECT 240, 220, 220, 145, white,0,45
vga.RECT 250, 225, 200, 200, white,1,45
'TFT.CIRCLE x, y, radius,color [, fill]
vga.circle 350,325,90,yellow,1
vga.circle 350,325,90,black
vga.RECT 250, 345, 200, 80,gold,1,5
vga.line 250,345,450,345,black,5
'VGA.TEXT.COLOR color [,background]
VGA.TEXT.COLOR black
VGA.TEXT.SIZE 2
vga.text.draw "0", 260,360
vga.text.draw "400", 350,245
vga.text.draw "800", 430,360
VGA.TEXT.SIZE 5
vga.text.draw "POWER", 350,390
val1=value/1
'VGA.NEEDLE x, y, length, angle, color [,thickness=1]
vga.needle 350,325,90,val1,red,10
vga.show
return
wait
example your value is 400
Code: [Local Link Removed for Guests]
' Assumptions
Min_Scale = 90
Max_Scale = 270
Min_Input = 0
Max_Input = 800
Value = 400
' Step 1: Calculate the proportion of input in the range
Proportion = (Value - Min_Input) / (Max_Input - Min_Input)
' Step 2: Apply the proportion to the scale range
Result = Min_Scale + Proportion * (Max_Scale - Min_Scale)
' Output the result
Output "Result: "; Result
Ron