Click here to Skip to main content
15,922,407 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: VB.Net on MacOSX with Mono Pin
Dave Kreskowiak28-Oct-07 4:18
mveDave Kreskowiak28-Oct-07 4:18 
AnswerRe: VB.Net on MacOSX with Mono Pin
DaveX8628-Oct-07 5:54
DaveX8628-Oct-07 5:54 
AnswerRe: VB.Net on MacOSX with Mono Pin
ryan11728-Oct-07 22:13
ryan11728-Oct-07 22:13 
GeneralSQL Express Backup Automated Pin
Darcy J Williamson27-Oct-07 9:33
Darcy J Williamson27-Oct-07 9:33 
GeneralRe: SQL Express Backup Automated Pin
Hesham Amin27-Oct-07 10:26
Hesham Amin27-Oct-07 10:26 
GeneralRe: SQL Express Backup Automated Pin
Paul Conrad27-Oct-07 13:04
professionalPaul Conrad27-Oct-07 13:04 
GeneralRe: SQL Express Backup Automated Pin
Darcy J Williamson27-Oct-07 14:11
Darcy J Williamson27-Oct-07 14:11 
QuestionBeginner needs help with VB6 / VB.NET Pin
a youda27-Oct-07 9:21
a youda27-Oct-07 9:21 
I’m not a programmer or a formal student, rather I’m a 48 year old that loves to tinker, and has no programming experience per say. What I need is to know where to find VB6 examples of a program similar to what I have described below to teach me how to create my application in VB6. If none of them exist or are readily available, than I need some basics to get me started and figure out how to create my desired program using the basic examples provided with the hardware I’m working with.
I’m attempting to create a program that will allow me to use the data from sensors connected to an interface board (Phidgets 8/8/8) primarily pressure & oxygen sensors, and with the data I receive from the sensors I will use that information to control servos with the same interface based on preset values or ranges automatically. The Phidgets Interface Kit 8/8/8 comes with software examples / basic software interfaces written in VB6 so you can receive data and view sensor input changes which I’m doing now. It also makes available similar modest software to control the servos. My endeavor is to use the software / code examples provided in VB6 to create a more advanced program that will allow me to monitor, record / document, automate and control my device through the servos based on the sensor information.
Below are examples of the general interface code and the servo controller code provided with the hardware.

VB6 examples provided with the hardware:
' Program: InterfaceKit-Controller
' Author: Saul Greenberg
' Date: October, 2001
' Version: 1.0
' Description:
' - Gives a handy generic visual interface to the interface kit.
' - It displays the status of all analog and digital inputs
' and lets you turn on/off the outputs.
' - Its not actually that complex, as most of this just builds
' the visual interface. It is, after all, dealing with 20
' different inputs and outputs!
' - Note that you can adjust the min/max to increase/decrease the
' apparant sensitivity of the sensor (although it may get jittery
' if you stretch it too far)
Option Explicit
Dim WithEvents IFKit As PhidgetInterfaceKit
'''''''''''''''''''''''''''''''''''''''''''
''' User interface
'''''''''''''''''''''''''''''''''''''''''''
Private Sub Form_Load()
Set IFKit = New PhidgetInterfaceKit
IFKit.Open

'If (IFKit.IsAttached = False) Then
' MsgBox "Couldn't Connect to Interface Kit"
' Unload Form1
' End
'End If
End Sub

'Turn individual outputs on or off depending on which Output checkbox was selected
Private Sub chkOutputDigital_Click(Index As Integer)
If chkOutputDigital(Index).Value = 0 Then
IFKit.OutputState(Index) = False
chkOutputDigital(Index).BackColor = &H8000000F
Else
IFKit.OutputState(Index) = True
chkOutputDigital(Index).BackColor = vbRed
End If
End Sub

Private Sub IFKit_OnDetach()
DisplayProperties False
End Sub

Private Sub IFKit_OnAttach()
DisplayProperties True
End Sub

Private Sub IFKit_OnError(ByVal Description As String, ByVal SCODE As Long)
MsgBox "Error " & SCODE & ": " & Description
IFKit.Close
Unload Form1
End
End Sub

Private Sub RatioSelect_Click()
If RatioSelect.Value = 0 Then
IFKit.Ratiometric = False
Else
IFKit.Ratiometric = True
End If
End Sub

'Let the user set the sensitivity of the sensor reporting through a combo box
'i.e., a delta of the given amount must be seen before it will report it

Private Sub sensitivity_Click(Index As Integer)
If sensitivity.Item(Index).Caption = "Medium" Then
sensitivity.Item(Index).Caption = "High"
IFKit.SensorChangeTrigger(Index) = 1
ElseIf sensitivity.Item(Index).Caption = "High" Then
sensitivity.Item(Index).Caption = "Low"
IFKit.SensorChangeTrigger(Index) = 60
ElseIf sensitivity.Item(Index).Caption = "Low" Then
sensitivity.Item(Index).Caption = "Medium"
IFKit.SensorChangeTrigger(Index) = 10
End If
End Sub



'''''''''''''''''''''''''''''''''''''''''''
''' Events generated by the Interface Kit
'''''''''''''''''''''''''''''''''''''''''''

'Report the value of the input whenever it changes
Private Sub IFKit_OnInputChange(ByVal Index As Long, ByVal NewState As Boolean)
If (Index >= lblInputDigital.Count) Then Exit Sub

If NewState Then
lblInputDigital(Index).Caption = "On"
Else
lblInputDigital(Index).Caption = "Off"
End If
End Sub



'Report the value of the sensor whenever it changes
Private Sub IFKit_OnSensorChange(ByVal Index As Long, ByVal SensorValue As Long)
If (Index >= sldrAnalog.Count) Then Exit Sub
sldrAnalog(Index).Value = SensorValue
lblAnalog(Index).Caption = SensorValue
End Sub

'''''''''''''''''''''''''''''''''''''''''''
''' Utility routines
'''''''''''''''''''''''''''''''''''''''''''

'Display the current properties of the IFKit in a label
Private Sub DisplayProperties(State As Boolean)
Dim i As Integer
lblProperties.Caption = ""
If State = False Then
Display "Detached"
Exit Sub
End If

Display "DeviceType: " & IFKit.DeviceType
Display "SerialNumber: " & IFKit.SerialNumber
Display "IsAttached: " & IFKit.IsAttached
Display "NumInputs: " & IFKit.NumInputs
Display "NumOutputs: " & IFKit.NumOutputs
Display "NumSensors: " & IFKit.NumSensors

Display ""
Display IFKit.LibraryVersion


End Sub

Private Sub Display(Line As String)
lblProperties.Caption = lblProperties.Caption & Line & vbCrLf
End Sub

Servo Slide Control Examples:
' Program: ServoSlider
' Author: Chester Fitchett
' Date: Feb 25, 2005
' Version: 1.0.2
' Description:
' -This example:
' o lets a user interactively adjust the angle of all motors through a slider
' o displays all the information it can about the PhidgetServo.
' o is somewhat robust about ignoring other Phidget servos that are attached
'

Option Explicit
Dim WithEvents Servo As PhidgetServo

Private Sub Form_Load()
Set Servo = New PhidgetServo
lblMessage.Caption = "Attach a PhidgetServo"
Frame1.Visible = False
sldrRotate.Min = -23
sldrRotate.Max = 231
sldrRotate.TickFrequency = 20
Servo.Open
End Sub

'SERVO ATTACHING
Private Sub Servo_OnAttach()
'Set up the slider
Frame1.Visible = True
sldrRotate.Value = 90
sldrRotate_Scroll 'Will rotate the motors to angle 0

'Show the current Servo information
lblMessage.Caption = "PhidgetServo Attached"
lblNumMotors.Caption = Servo.NumMotors
lblSerialNumber.Caption = Servo.SerialNumber
End Sub

Private Sub Servo_OnDetach()
'Show the current Servo information
lblMessage.Caption = "Attach a PhidgetServo "
lblNumMotors.Caption = ""
lblSerialNumber.Caption = ""
lblAngle.Caption = ""
Frame1.Visible = False
End Sub

Private Sub sldrRotate_Scroll()
Dim Index As Long
For Index = 0 To Servo.NumMotors - 1
Servo.MotorPosition(Index) = sldrRotate.Value
lblAngle.Caption = Servo.MotorPosition(Index)
Next Index
End Sub


AnswerRe: Beginner needs help with VB6 / VB.NET Pin
Paul Conrad27-Oct-07 13:04
professionalPaul Conrad27-Oct-07 13:04 
AnswerRe: Beginner needs help with VB6 / VB.NET Pin
MikeMarq27-Oct-07 17:24
MikeMarq27-Oct-07 17:24 
AnswerRe: Beginner needs help with VB6 / VB.NET Pin
DaveX8627-Oct-07 20:33
DaveX8627-Oct-07 20:33 
QuestionTo create page turn effect Pin
bapu288927-Oct-07 8:46
bapu288927-Oct-07 8:46 
AnswerRe: To create page turn effect Pin
Paul Conrad27-Oct-07 13:05
professionalPaul Conrad27-Oct-07 13:05 
GeneralRe: To create page turn effect Pin
bapu288927-Oct-07 22:34
bapu288927-Oct-07 22:34 
GeneralRe: To create page turn effect Pin
Paul Conrad28-Oct-07 6:20
professionalPaul Conrad28-Oct-07 6:20 
GeneralRe: To create page turn effect Pin
bapu288928-Oct-07 6:59
bapu288928-Oct-07 6:59 
QuestionSmall Problem with File System Watcher Pin
LloydA11127-Oct-07 3:50
LloydA11127-Oct-07 3:50 
AnswerRe: Small Problem with File System Watcher Pin
Luc Pattyn27-Oct-07 4:15
sitebuilderLuc Pattyn27-Oct-07 4:15 
GeneralRe: Small Problem with File System Watcher Pin
LloydA1112-Nov-07 11:50
LloydA1112-Nov-07 11:50 
GeneralRe: Small Problem with File System Watcher Pin
Luc Pattyn2-Nov-07 12:46
sitebuilderLuc Pattyn2-Nov-07 12:46 
QuestionPrinting calculated amount in words in Crystal Report 8.0 Pin
Kiran S. S.27-Oct-07 3:36
Kiran S. S.27-Oct-07 3:36 
AnswerRe: Printing calculated amount in words in Crystal Report 8.0 Pin
Dave Kreskowiak27-Oct-07 5:08
mveDave Kreskowiak27-Oct-07 5:08 
QuestionError on summary feild in crystal report Pin
yogesh_kumar_agarwal27-Oct-07 2:12
yogesh_kumar_agarwal27-Oct-07 2:12 
AnswerRe: Error on summary feild in crystal report Pin
AliAmjad27-Oct-07 2:45
AliAmjad27-Oct-07 2:45 
GeneralRe: Error on summary feild in crystal report Pin
yogesh_kumar_agarwal27-Oct-07 2:49
yogesh_kumar_agarwal27-Oct-07 2:49 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.