Need Help please and Thanks

Supporting Visual Studio on Windows
Biggermens
Phidgetsian
Posts: 13
Joined: Sun Aug 02, 2009 9:55 pm
Contact:

Need Help please and Thanks

Postby Biggermens » Sun Aug 02, 2009 10:13 pm

I need Help please i am very new to VB.net Programing and i got a 8/8/8 with themp sencor

i made a small program and i got it kinda working i can get the SN# from the board what i need help it i am looking for the line of code that i can get the info from one analog input at a time ?

somthing like get info from sencor 0
and a difrent line for sencor 1 and so on

i looked at all the sample code and thay pull the info from all 8 at a time i just want the one at a time

and i no thay have programing manuals ect.. but i have a hard time reading at you can probably see from my spelling

Thanks in advance

kershaw

Re: Need Help please and Thanks

Postby kershaw » Mon Aug 03, 2009 1:22 pm

Hi there,
This might be a case of the blind leading the blind because im a newbie to all this as well but i'll do what I can.

I was able to display the reading from a analog sensor(temp) using the sub routine below
It does a little bit more than just read the value, it also sets the sensitivity of the sensor and converts to degrees C(see user guide for temp sensor).

Sub sensor_1()
Dim temperature As Single
phidetIFK.sensors(0).Sensitivity = 2 '

temperature = ((phidgetIFK.sensors(0).Value * 0.2222) - 61.111)


TextBox1.Text = temperature.ToString()

End Sub

To call the sub simply put it into the sensorChange event handler like below
Private Sub phidgetIFK_SensorChange(ByVal sender As Object, ByVal e As Phidgets.Events.SensorChangeEventArgs) Handles phidgetIFK.SensorChange
sensor_1()
End Sub



Hope this helps,
Keith

Biggermens
Phidgetsian
Posts: 13
Joined: Sun Aug 02, 2009 9:55 pm
Contact:

Re: Need Help please and Thanks

Postby Biggermens » Tue Aug 04, 2009 8:43 pm

It Worked thanks now for all the other analog sencor all i have to do is change the input to the one i want and set the sencativity

would i be pushing my luck if i ask if you have the code to work the digital in and the digital out ???


Thanks Agine

kershaw

Re: Need Help please and Thanks

Postby kershaw » Wed Aug 05, 2009 11:13 am

Hi there glad you got that working, it took me a good while to figure out. THe inputs and outputs work similarly just call the one you want directly. The snipit below uses a command button to to turn on and off an output.

Private Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
If phidgetIFK.outputs(0) = False Then
phidgetIFK.outputs(0) = True
Else
phidgetIFK.outputs(0) = False

End If



Using inputs to turn on and off outputs is similar as shown below. I have it done in a sub and then referenced in the inputs event handler but you could put it straight in to the event handler too.
Private Sub inout1()
If phidgetIFK.inputs(0) = True Then
phidgetIFK.outputs(0) = True
ElseIf phidgetIFK.inputs(0) = False Then

phidgetIFK.outputs(0) = False
End If
End Sub

Here is the event handler
Private Sub phidgetIFK_InputChange(ByVal sender As Object, ByVal e As Phidgets.Events.InputChangeEventArgs) Handles phidgetIFK.InputChange

keith3()

End Sub

I hope this is a help, it's hard to get up and running, I am still getting stuck with lots of stuff. My biggest problem is getting time. 30 min here and there is just not enough.


Whats your plan for the phidget? I am just playing and having fun getting it to do basic tasks at the moment but eventually I would like to do some stuff with servos and steppers, maybe make a robot arm or something like that.


Have fun and post again soon
Keith

Biggermens
Phidgetsian
Posts: 13
Joined: Sun Aug 02, 2009 9:55 pm
Contact:

Re: Need Help please and Thanks

Postby Biggermens » Wed Aug 05, 2009 1:55 pm

Thanks a bunch i got this for fun too and wanted to make my own fule injected system for my mini bike but that is ways away

Thanks


Return to “VB .NET”

Who is online

Users browsing this forum: No registered users and 1 guest