Can I attach a potentiometer as shown in the picture below to test my analog input code?
My expectation is that as I vary the pot, the values read from pin A will change accordingly. The code is a simple (FreeBASIC; [size=85]thanks zoomkat[/size]) program that loops, issues the command to read the analog value from pin A (VA ) and prints the raw result to the screen.
[code]Dim As String qs, dat
Dim As Integer i, maxiter, level
qs = “VA” + Chr(13)
maxiter = 100
Print "# of loops: ";
Input maxiter
For i=1 to maxiter
Open Com “COM4: 115200,N,8,1,BIN,CD,CS,DS,RS” For Binary As #1
Put #1, qs
Sleep 20
dat = Input$(Loc(1), #1)
Close #1
If dat = “” Then
Print “Nothing came back :(”
Else
Print "Returned value ";asc(dat)
End If
next i
fini:
End
[/code]
Thanks,
dj