tag:blogger.com,1999:blog-1978728424657100262.post1972257841486536025..comments2023-05-29T04:03:45.821-07:00Comments on Narobo Blog: Interface CompletedErichttp://www.blogger.com/profile/02774826745639335551noreply@blogger.comBlogger2125tag:blogger.com,1999:blog-1978728424657100262.post-17330806413958433402007-07-13T03:21:00.001-07:002007-07-13T03:21:00.001-07:00I know some of it is a bit repetitive, but I left ...I know some of it is a bit repetitive, but I left it on for now.Erichttps://www.blogger.com/profile/02774826745639335551noreply@blogger.comtag:blogger.com,1999:blog-1978728424657100262.post-46799603774224417792007-07-13T03:21:00.000-07:002007-07-13T03:21:00.000-07:00' reminder: requires certain dll's ''Made By Eric ...' reminder: requires certain dll's '<BR/>'Made By Eric Forkosh'<BR/>Option Explicit<BR/>Dim WithEvents IFKit As PhidgetInterfaceKit 'Phidgets Identifier'<BR/>Private WithEvents Cd1 As ccrpCountdown 'Setting up Timer identifiers'<BR/>Private WithEvents Cd2 As ccrpCountdown<BR/>Private WithEvents Cd3 As ccrpCountdown<BR/><BR/><BR/><BR/>Private Sub Check1_Click() ' Turn On all Outputs Checkbox Control'<BR/>Dim i As Long<BR/> Dim state As Boolean<BR/> If chkOn.Value = Checked Then state = True Else state = False<BR/> For i = 0 To IFKit.NumOutputs - 1<BR/> IFKit.OutputState(i) = state<BR/> Next i<BR/>End Sub<BR/>'Clear All Outputs Command'<BR/>Private Sub Clear_Click()<BR/>Dim q As Long<BR/>For q = 0 To 15<BR/>Output(q).Value = Unchecked<BR/>Next q<BR/>chkOn.Value = Unchecked<BR/>Dim w As Long<BR/><BR/>For w = 0 To IFKit.NumOutputs - 1<BR/> IFKit.OutputState(w) = False<BR/> Next w<BR/>With Player(5)<BR/> .Command = "Close"<BR/> .filename = "C:\Voice\cleared.wav" ' Set the file to be played'<BR/><BR/> .Command = "Open" ' Open the file<BR/><BR/> .Command = "Play" ' Play the file<BR/> <BR/> <BR/> End With<BR/>End Sub<BR/>'Back To Home Command Control'<BR/>Private Sub Command1_Click()<BR/>Start.Show<BR/>Unload Me<BR/>End Sub<BR/>'Exit Control'<BR/>Private Sub Close_Click()<BR/>Unload Me<BR/>End Sub<BR/><BR/>'Abort command Control'<BR/>Private Sub Command3_Click()<BR/>Output(0).Value = Unchecked<BR/>Output(1).Value = Unchecked<BR/>Output(2).Value = Unchecked<BR/>Output(3).Value = Unchecked<BR/>Dim i As Long<BR/> Dim state As Boolean<BR/> For i = 0 To IFKit.NumOutputs - 1<BR/> IFKit.OutputState(i) = False<BR/> Next i<BR/> Arrow1.Picture = LoadPicture("C:\Voice\blank.gif")<BR/> Arrow2.Picture = LoadPicture("C:\Voice\blank.gif")<BR/> With Player(4)<BR/> .Command = "Close"<BR/> .filename = "C:\Voice\stop.wav" ' Set the file to be played'<BR/> .Command = "Open" ' Open the file<BR/><BR/> .Command = "Play" ' Play the file<BR/> <BR/> <BR/> End With<BR/><BR/><BR/><BR/>End Sub<BR/><BR/>Private Sub Command5_Click(Index As Integer)<BR/>'Forward Command Control'<BR/>Output(0).Value = Checked<BR/>Output(1).Value = Unchecked<BR/>Output(2).Value = Checked<BR/>Output(3).Value = Unchecked<BR/><BR/><BR/>Dim i As Long<BR/> Dim state As Boolean<BR/> For i = 0 To IFKit.NumOutputs - 1<BR/> IFKit.OutputState(i) = False 'Turn off all outputs'<BR/> Next i<BR/> For i = 0 To IFKit.NumOutputs - 1 'Only Turn on Output 0 and Output 2'<BR/> IFKit.OutputState(0) = True<BR/> IFKit.OutputState(2) = True<BR/> Next i<BR/> With Cd2<BR/> .Enabled = False<BR/> End With<BR/> With Cd3<BR/> .Enabled = False<BR/> End With<BR/> With Cd1<BR/> .Enabled = True<BR/> <BR/> <BR/> End With<BR/> Arrow1.Picture = LoadPicture("C:\Voice\2.gif") 'Load Forward Motor Direction Arrow'<BR/> Arrow2.Picture = LoadPicture("C:\Voice\2.gif")<BR/>With Player(0)<BR/> .Command = "Close"<BR/> .filename = "C:\Voice\goingforward.wav" ' Set the file to be played<BR/><BR/> .Command = "Open" ' Open the file<BR/><BR/> .Command = "Play" ' Play the file<BR/><BR/> End With<BR/><BR/>End Sub<BR/>'Right Command Control'<BR/>Private Sub Command6_Click(Index As Integer)<BR/>Output(0).Value = Checked<BR/>Output(1).Value = Unchecked<BR/>Output(2).Value = Unchecked<BR/>Output(3).Value = Checked<BR/><BR/>Dim i As Long<BR/> Dim state As Boolean<BR/> For i = 0 To IFKit.NumOutputs - 1<BR/> IFKit.OutputState(i) = False<BR/> Next i<BR/> For i = 0 To IFKit.NumOutputs - 1<BR/> IFKit.OutputState(0) = True<BR/> IFKit.OutputState(3) = True<BR/> Next i<BR/> With Cd1<BR/> .Enabled = False<BR/> End With<BR/> <BR/> With Cd3<BR/> .Enabled = False<BR/> End With<BR/> With Cd2<BR/> .Enabled = True<BR/> <BR/> <BR/> End With<BR/> Arrow1.Picture = LoadPicture("C:\Voice\2.gif")<BR/> Arrow2.Picture = LoadPicture("C:\Voice\1.gif")<BR/> <BR/> With Player(1)<BR/> .Command = "Close"<BR/> .filename = "C:\Voice\goingright.wav" ' Set the file to be played<BR/><BR/> .Command = "Open" ' Open the file<BR/><BR/> .Command = "Play" ' Play the file<BR/><BR/> End With<BR/>End Sub<BR/><BR/>'Reverse Command Control'<BR/>Private Sub Command7_Click()<BR/>Output(0).Value = Unchecked<BR/>Output(1).Value = Checked<BR/>Output(2).Value = Unchecked<BR/>Output(3).Value = Checked<BR/>Dim i As Long<BR/> Dim state As Boolean<BR/> For i = 0 To IFKit.NumOutputs - 1<BR/> IFKit.OutputState(i) = False<BR/> Next i<BR/> For i = 0 To IFKit.NumOutputs - 1<BR/> IFKit.OutputState(1) = True<BR/> IFKit.OutputState(3) = True<BR/> Next i<BR/> With Cd1<BR/> .Enabled = False<BR/> End With<BR/> <BR/> With Cd2<BR/> .Enabled = False<BR/> End With<BR/> With Cd3<BR/> .Enabled = True<BR/> <BR/> <BR/> End With<BR/> Arrow1.Picture = LoadPicture("C:\Voice\1.gif")<BR/> Arrow2.Picture = LoadPicture("C:\Voice\1.gif")<BR/> <BR/>With Player(3)<BR/> .Command = "Close"<BR/> .filename = "C:\Voice\goingreverse.wav" ' Set the file to be played<BR/><BR/> .Command = "Open" ' Open the file<BR/><BR/> .Command = "Play" ' Play the file<BR/><BR/> End With<BR/> End Sub<BR/> <BR/><BR/><BR/><BR/>'Left Command Control'<BR/>Private Sub Command8_Click()<BR/><BR/>Output(0).Value = Unchecked<BR/>Output(1).Value = Checked<BR/>Output(2).Value = Checked<BR/>Output(3).Value = Unchecked<BR/>Dim i As Long<BR/> Dim state As Boolean<BR/> For i = 0 To IFKit.NumOutputs - 1<BR/> IFKit.OutputState(i) = False<BR/> Next i<BR/> For i = 0 To IFKit.NumOutputs - 1<BR/> IFKit.OutputState(1) = True<BR/> IFKit.OutputState(2) = True<BR/> <BR/> With Cd1<BR/> .Enabled = False<BR/> End With<BR/> <BR/> With Cd3<BR/> .Enabled = False<BR/> End With<BR/> With Cd2<BR/> .Enabled = True<BR/> <BR/> <BR/> End With<BR/> Next i<BR/> Arrow1.Picture = LoadPicture("C:\Voice\1.gif")<BR/> Arrow2.Picture = LoadPicture("C:\Voice\2.gif")<BR/> With Player(5)<BR/> .Command = "Close"<BR/> .filename = "C:\Voice\goingleft.wav" ' Set the file to be played<BR/><BR/> .Command = "Open" ' Open the file<BR/><BR/> .Command = "Play" ' Play the file<BR/><BR/> End With<BR/>End Sub<BR/><BR/><BR/><BR/><BR/><BR/><BR/>Private Sub Form_Load()<BR/><BR/>Set Cd1 = New ccrpCountdown<BR/>Set Cd2 = New ccrpCountdown<BR/>Set Cd3 = New ccrpCountdown<BR/><BR/> 'Set Up Durations and Intervals of Countdowns'<BR/> <BR/> With Cd1 'Forward Command<BR/> .Duration = 4000 ' 4 seconds<BR/> .Interval = 100 ' 0.1 seconds<BR/> .Enabled = False<BR/> <BR/> <BR/> End With<BR/> With Cd2 'Turning Command<BR/> .Duration = 2000 ' 2 seconds<BR/> .Interval = 100 ' 0.1 seconds<BR/> .Enabled = False<BR/> <BR/> <BR/> End With<BR/> With Cd3 'Backward Command<BR/> .Duration = 3000 ' 3 seconds<BR/> .Interval = 100 ' 0.1 seconds<BR/> .Enabled = False<BR/> <BR/> <BR/> End With<BR/>With Player(0)<BR/> .Command = "Close"<BR/> .filename = "C:\Voice\yesmaster.wav" ' Set the file to be played when program starts<BR/><BR/> .Command = "Open" ' Open the file<BR/><BR/> .Command = "Play" ' Play the file<BR/><BR/> End With<BR/> Set IFKit = New PhidgetInterfaceKit 'Get the phidget manager going<BR/> chkOn.Enabled = False 'interactive only when the phidget is attached<BR/> IFKit.Open<BR/> <BR/>End Sub<BR/><BR/>'Toggle all outputs on or off.<BR/>Private Sub chkOn_Click()<BR/> Dim state As Boolean<BR/> If chkOn.Value = Checked Then state = True Else state = False<BR/> Dim E As Long<BR/> For E = 0 To 15<BR/> IFKit.OutputState(E) = state<BR/> <BR/> If chkOn.Value = Checked Then GoTo Label Else: GoTo NoLabel<BR/>Label: Output(E).Value = Checked<BR/> With Player(0)<BR/> .Command = "Close"<BR/> .filename = "C:\Voice\AllOn.wav" ' Set the file to be played<BR/><BR/> .Command = "Open" ' Open the file<BR/><BR/> .Command = "Play" ' Play the file<BR/><BR/> End With<BR/> GoTo Next1<BR/>NoLabel: Output(E).Value = Unchecked<BR/>Next1: Next E<BR/>End Sub<BR/><BR/>'An InterfaceKit was found. Start everything up<BR/>Private Sub IFKit_OnAttach()<BR/> Dim i As Long<BR/> 'make the sensors less sensitive so that we don't get flooded with events<BR/> For i = 0 To IFKit.NumSensors - 1<BR/> IFKit.SensorChangeTrigger(i) = 30<BR/> Next i<BR/> chkOn.Enabled = True<BR/> lblSerialNumber.Caption = "Serial Number : " & IFKit.SerialNumber<BR/> lblVersion.Caption = "Device Version : " & IFKit.DeviceVersion<BR/> <BR/>End Sub<BR/><BR/>'The Interface kit was detached. Clean up, and stop polling.<BR/>Private Sub IFKit_OnDetach()<BR/>Dim Ans As String<BR/><BR/> chkOn.Enabled = False<BR/> Ans = MsgBox("Phidgets Interface Kit Has Been Disconnected!", 16, "Phidget Disconnected!")<BR/>End Sub<BR/><BR/>'Report the value of the input whenever it changes<BR/>Private Sub IFKit_OnInputChange(ByVal Index As Long, ByVal NewState As Boolean)<BR/> Display " Input " & Index & " = " & NewState<BR/> If (Index > 15) Then Exit Sub<BR/> <BR/> If (NewState) Then<BR/> InputD(Index).Value = 1<BR/> Else<BR/> InputD(Index).Value = 0<BR/> End If<BR/> <BR/>If InputD(0).Value = Checked Then Shape2(0).FillStyle = 0 Else Shape2(0).FillStyle = 1<BR/>If InputD(1).Value = Checked Then Shape2(1).FillStyle = 0 Else Shape2(1).FillStyle = 1<BR/>If InputD(2).Value = Checked Then Shape2(2).FillStyle = 0 Else Shape2(2).FillStyle = 1<BR/>If InputD(3).Value = Checked Then Shape2(3).FillStyle = 0 Else Shape2(3).FillStyle = 1<BR/>If InputD(4).Value = Checked Then Shape2(4).FillStyle = 0 Else Shape2(4).FillStyle = 1<BR/>End Sub<BR/><BR/>'Report the value of the output whenever it changes<BR/>Private Sub IFKit_OnOutputChange(ByVal Index As Long, ByVal NewState As Boolean)<BR/> Display "Output " & Index & " = " & NewState<BR/>End Sub<BR/><BR/>'Report the value of the sensor whenever it changes<BR/>Private Sub IFKit_OnSensorChange(ByVal Index As Long, ByVal SensorValue As Long)<BR/> Display "Sensor " & Index & " = " & SensorValue<BR/>End Sub<BR/><BR/>Private Sub Display(Entry As String)<BR/> Text1.Text = Entry & vbCrLf & Text1.Text<BR/>End Sub<BR/><BR/>Private Sub nav_Click()<BR/>Output(0).Value = Checked<BR/>Output(1).Value = Unchecked<BR/>Output(2).Value = Checked<BR/>Output(3).Value = Unchecked<BR/><BR/><BR/>Dim i As Long<BR/> Dim state As Boolean<BR/> For i = 0 To IFKit.NumOutputs - 1<BR/> IFKit.OutputState(i) = False<BR/> Next i<BR/> For i = 0 To IFKit.NumOutputs - 1<BR/> IFKit.OutputState(0) = True<BR/> IFKit.OutputState(2) = True<BR/> Next i<BR/> <BR/> <BR/> Arrow1.Picture = LoadPicture("C:\Voice\2.gif")<BR/> Arrow2.Picture = LoadPicture("C:\Voice\2.gif")<BR/>With Player(0)<BR/> .Command = "Close"<BR/> .filename = "C:\Voice\cruise.wav" ' Set the file to be played<BR/><BR/> .Command = "Open" ' Open the file<BR/><BR/> .Command = "Play" ' Play the file<BR/><BR/> End With<BR/>End Sub<BR/><BR/>Private Sub Output_Click(Index As Integer)<BR/> IFKit.OutputState(Index) = Output(Index).Value<BR/>End Sub<BR/><BR/><BR/>Private Sub Cd1_timer()<BR/>'Clear All Outputs'<BR/>Dim q As Long<BR/>For q = 0 To 15<BR/>Output(q).Value = Unchecked<BR/>Next q<BR/>chkOn.Value = Unchecked<BR/>Dim w As Long<BR/><BR/>For w = 0 To IFKit.NumOutputs - 1<BR/> IFKit.OutputState(w) = False<BR/> Next w<BR/> With Player(4)<BR/> .Command = "Close"<BR/> .filename = "C:\Voice\stop.wav" ' Set the file to be played- Cape Cod camera Test http://www.capecodlivecam.com/hyannisharbor.shtml'<BR/><BR/> .Command = "Open" ' Open the file<BR/><BR/> .Command = "Play" ' Play the file<BR/> <BR/> <BR/> End With<BR/> Arrow1.Picture = LoadPicture("C:\Voice\blank.gif")<BR/> Arrow2.Picture = LoadPicture("C:\Voice\blank.gif")<BR/>End Sub<BR/><BR/>Private Sub Cd2_timer()<BR/>'Clear All Outputs'<BR/>Dim q As Long<BR/>For q = 0 To 15<BR/>Output(q).Value = Unchecked<BR/>Next q<BR/>chkOn.Value = Unchecked<BR/>Dim w As Long<BR/><BR/>For w = 0 To IFKit.NumOutputs - 1<BR/> IFKit.OutputState(w) = False<BR/> Next w<BR/> With Player(4)<BR/> .Command = "Close"<BR/> .filename = "C:\Voice\stop.wav" ' Set the file to be played- Cape Cod camera Test http://www.capecodlivecam.com/hyannisharbor.shtml'<BR/><BR/> .Command = "Open" ' Open the file<BR/><BR/> .Command = "Play" ' Play the file<BR/> <BR/> <BR/> End With<BR/> Arrow1.Picture = LoadPicture("C:\Voice\blank.gif")<BR/> Arrow2.Picture = LoadPicture("C:\Voice\blank.gif")<BR/>End Sub<BR/><BR/>Private Sub Cd3_timer()<BR/>'Clear All Outputs'<BR/>Dim q As Long<BR/>For q = 0 To 15<BR/>Output(q).Value = Unchecked<BR/>Next q<BR/>chkOn.Value = Unchecked<BR/>Dim w As Long<BR/><BR/>For w = 0 To IFKit.NumOutputs - 1<BR/> IFKit.OutputState(w) = False<BR/> Next w<BR/> With Player(4)<BR/> .Command = "Close"<BR/> .filename = "C:\Voice\stop.wav" ' Set the file to be played- Cape Cod camera Test http://www.capecodlivecam.com/hyannisharbor.shtml'<BR/><BR/> .Command = "Open" ' Open the file<BR/><BR/> .Command = "Play" ' Play the file<BR/> <BR/> <BR/> End With<BR/> Arrow1.Picture = LoadPicture("C:\Voice\blank.gif")<BR/> Arrow2.Picture = LoadPicture("C:\Voice\blank.gif")<BR/>End SubErichttps://www.blogger.com/profile/02774826745639335551noreply@blogger.com