Include "ADC.bas" // Include the ADC.bas library you had this / Include "ADC.bas" didn't need the backslash
Dim LED0 As PORTA.0 // Declare the LED pin
//Dim LED1 As PORTB.1
Dim LED2 As PORTA.6
Dim result As Word
Function Get_ADC_Sample() As Word // Function to grab the ADC sample
result = ADC.Read(1) // Grab an ADC sample from channel 0
result =result * 2 // Scale the answer up by a factor of 2
End Function
OSCCON = %01110110 // Setup the internal OSC for 8Mhz
Input(PORTA.1) // Make AN1 an inputconnected to VR1 on junebug
PORTA.6=0
//result =0 // clears Aresults
//While True // Create an infinate loop
//If Aresult > 128 Then
// High (LED0)
//EndIf
//Wend
while True // Create an infinite loop
If Get_ADC_Sample > 128 Then
High (LED0)
EndIf
Wend