Sub Process_Globals
Public Serial1 As Serial
Public mcp As MCP4xxx 'testing for MCP4131
Public const total=9800 As UInt 'measured from term A to B
Public const wiperohms=110 As UInt 'measured from term A to wiper when wiper is at 0
Public ohminc=0 As UInt
End Sub
Private Sub AppStart
Serial1.Initialize(9600)
Log("AppStart")
'testing for MCP4131
mcp.Initialize(10,mcp.POT_0,mcp.RES7BIT,mcp.POTENTIOMETER)
Log("wiper range ",mcp.WiperRange)
ohminc=total/mcp.WiperRange
Log("increments of ",ohminc," ohms")
Log("wiper pos ",mcp.WiperGet)
Log("Is terminal A is connected? ",mcp.ConnTermA)
mcp.ConnTermASet(False)
Log("Is terminal A is connected? ",mcp.ConnTermA)
mcp.ConnTermASet(True)
Log("Is terminal A is connected? ",mcp.ConnTermA)
swing_wiper
End Sub
Sub swing_wiper
Do While True
For i = 0 To 127
mcp.WiperSet(i)
'mcp.WiperIncrement
Log("Set to: ",(mcp.WiperGet*ohminc)+wiperohms," ohms")
Delay(5000)
Next
Loop
End Sub