by suv23 » Thu May 05, 2011 10:47 am
by suv23
Thu May 05, 2011 10:47 am
this is my sensor program..this program only can read value 1023..after the value have remove from textbox and read again, the same value will appear although the range of sensor to detect was change..
Imports RoBoIO_DotNet.RoBoIO ' import the RoBoIO .Net Warper
Public Class Form1
Dim adc_data As Integer
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
TextBox1.Text = ""
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
If (spi_Init(SPICLK_21400KHZ) = False) Then ' init SPI lib for accessing the A/D converter
End If
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
adc_data = adc_ReadChannel(ADC_USECHANNEL0, ADCMODE_RANGE_2VREF, ADCMODE_UNSIGNEDCODING)
TextBox1.Text = adc_data
End Sub
End Class
this is my sensor program..this program only can read value 1023..after the value have remove from textbox and read again, the same value will appear although the range of sensor to detect was change..
Imports RoBoIO_DotNet.RoBoIO ' import the RoBoIO .Net Warper
Public Class Form1
Dim adc_data As Integer
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
TextBox1.Text = ""
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
If (spi_Init(SPICLK_21400KHZ) = False) Then ' init SPI lib for accessing the A/D converter
End If
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
adc_data = adc_ReadChannel(ADC_USECHANNEL0, ADCMODE_RANGE_2VREF, ADCMODE_UNSIGNEDCODING)
TextBox1.Text = adc_data
End Sub
End Class