Sorry for the late response! Here is the code:
CLS
Dim integer dat
Dim integer dat2
Dim integer buf(320)
Dim integer buf2(320)
SetPin 31, ain
SetPin 32, ain
SetPin 34, ain
SetPin gp0, dout
SetPin gp1, dout
SetPin gp2, din
SetPin gp18, din, pulldown
Text 100, 5, "Universal Plotter", lt
Line 30,50,30,222,2,RGB(yellow)
Line 30,220,320,220,2,RGB(yellow)
Text 27,225, "0"
Text 70,225, "50"
Text 120,225, "100"
Text 170,225, "150"
Text 220,225, "200"
Text 270,225, "250"
Text 30,215, "0" ,rm
Text 30,165, "50",rm
Text 30,115, "100",rm
Text 30,65, "150",rm
Do
Line 32, 165, 320, 165, 1, RGB(grey)
Line 32, 115, 320, 115, 1, RGB(grey)
Line 32, 65, 320, 65, 1, RGB(grey)
temp1
If Pin(gp18) = 1 Then
shift_draw_buf
Else
clear_aquire_buf
EndIf
p= Cint((Pin(32)*10000)/9)-370
If p <0 Then p=0
Pause p
Loop
Sub temp1()
Pin(gp1) = 1
Pause 200
Pin(gp1) = 0
Pin(gp0)=1: Pin(gp0)=0
temp_raw = 0
For i=12 To 1 Step -1
Pin(gp0)=1
b=1
For j=2 To i
b = b*2
Next j
so=Pin(gp2)
temp_raw = temp_raw + (b*so)
Pin(gp0)=0
Next i
Print " TEMP: ", temp_raw, temp_raw*0.25
Pin(gp0) = 1
Print Pin(gp2)
Pin(gp0) = 0
Pin(gp1)=1
End Sub
Sub clear_aquire_buf
For i=32 To 320
Pixel i, buf(i), RGB(black)
Pixel i,buf2(i), RGB(black)
buf(i) = 230 - Cint(Pin(31)*50)
buf2(i) =230 - Cint(Pin(34)*50)
Pixel i, buf(i), RGB(green)
Pixel i, buf2(i), RGB(magenta)
Next i
End Sub
Sub shift_draw_buf
dat = 230 - Cint(Pin(31)*50)
dat2 = 230 -Cint(Pin(34)*50)
For i=32 To 320
Pixel i, buf(i-1), RGB(black)
Pixel i, buf2(i-1),RGB(black)
buf(i-1) = buf(i)
buf2(i-1)= buf2(i)
Pixel i, buf(i),RGB(green)
Pixel i, buf2(i),RGB(magenta)
Next i
buf(320)=dat
buf2(320)=dat2
End Sub
It is very dirty at the moment! I have now added a second channel and support for type-k themperature sensors (max6675). the next thing i want to add is the current sensor ina219 and support for uart. Then i am able to plot / visualize different Data like voltage, current, power, temperature and UART Data. All on two channels! After that i will add printer support for cheap chinese Thermal printer to print the plots :-)