3 Replies - 4433 Views - Last Post: 06 April 2008 - 07:45 PM Rate Topic: -----

#1 xeia_yumilka  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 27-March 08

controlling parallel port through web

Post icon  Posted 27 March 2008 - 10:34 PM

does anyone have any idea on how to control the movements of a stepper motor interfaced into the computer's parallel port, through a php dynamic web page? the web server we are using is apache operating under windows xp...

i am going to insert our code...can anyone please help me to fix it:

'Option Explicit

Public checker As Integer
Public i As Double
Public k As Integer
Public counter As Integer
Private buffArr(0 To 100) As String
Private toBeExec As String

Private Sub Form_Load()

timerGetFile.Interval = 1000
timerGetFile.Enabled = True
speed.Enabled = True

End Sub
Private Sub About_Click()
msg$ = "Video Surveillance Alpha 1.0 " + Chr$(13) + Chr$(13)
msg$ = msg$ + " by" + Chr$(13)
msg$ = msg$ + Chr$(13) + "Joanne L. Bato" + Chr$(13)
msg$ = msg$ + "Jane Glossil S. Ventorillo" + Chr$(13)
MsgBox msg$, vbInformation, "User Guide..."
End Sub

Private Sub Command1_Click()
'for clockwise
Clockwise

End Sub
Private Function Clockwise()
Timer4.Interval = 30
Timer4.Enabled = True
'k = 0
'Timer4.Interval = 30
'Timer4.Enabled = True

End Function

Private Sub Command2_Click()
'counterClockwise
counterClockwise

End Sub
Private Function counterClockwise()
Timer3.Interval = 30
Timer3.Enabled = True
'k = 0
'Timer3.Interval = 30
'Timer3.Enabled = True

End Function

Private Sub Command3_Click()
'up
uP

End Sub
Private Function uP()

Timer1.Interval = 30
Timer1.Enabled = True

End Function
Private Sub Command4_Click()
' down
DowN

End Sub
Private Function DowN()

Timer2.Interval = 30
Timer2.Enabled = True

End Function
Private Sub Command5_Click()

Call brake

End Sub

Private Function brake()

Timer2.Enabled = False
Timer2.Interval = 0
Timer3.Enabled = False
Timer3.Interval = 0
Timer1.Enabled = False
Timer1.Interval = 0
Timer4.Enabled = False
Timer4.Interval = 0
Out &H378, 2 ^ 0

End Function
Private Sub Exit1_Click()
Out &H378, 0
End Sub

Private Sub Form_Unload(Cancel As Integer)

MsgBox "Take a Look at this!", vbOKCancel, "taks..Taks!"

End Sub

Private Sub speed_Timer()

txtSpeed.Text = getSpeed

End Sub

Private Sub Timer1_Timer()
Static n As Integer
Out &H378, 2 ^ (n)
n = n + 1
If n = 4 Then
n = 0
End If
End Sub

Private Sub Timer2_Timer()

Static n As Integer
If n = 0 Then
n = 4
End If
Out &H378, 2 ^ (n - 1)
n = n - 1

'Static n As Integer
'Out &H378, 2 ^ (n - 1)
'n = n - 1
'If n = 0 Then
'n = 4
'End If
End Sub

Private Sub Timer3_Timer()

Static n As Integer

Out &H378, 2 ^ (n)
If n = 0 Then
n = 3
End If
n = n + 1
If n = 8 Then
n = 4
End If
'Static n As Integer

'If k = 0 Then
'Out &H378, 2 ^ (n)
'k = 3
'n = 4
'End If
'If n < 8 Then
'Out &H378, 2 ^ (n)
'Else
'n = 3
'End If
'n = n + 1
End Sub

Private Sub Timer4_Timer()
Static n As Integer
If k = 0 Then
Out &H378, 2 ^ (n)
k = 8
n = 7
End If
If n > 3 Then
Out &H378, 2 ^ (n)
Else
n = 8
End If
n = n - 1
End Sub

'===================
Private Function getFromTxt() As String

Dim comFrmTxt, comm As String

On Error Resume Next

Open "C:\xampp\htdocs\theonlooker\onLooker1.txt" For Input As #1
Input #1, comFrmTxt

getFromTxt = comFrmTxt
execComm (getFromTxt)

'Label3.Caption = comFrmTxt

Close #1

End Function

Private Function getSpeed() As String

Dim comSpeed, sp As String

On Error Resume Next

Open "C:\xampp\htdocs\theonlooker\speed.txt" For Input As #1
Input #1, comSpeed

getSpeed = comSpeed
'Label3.Caption = comFrmTxt

Close #1

End Function
Private Function putToBuffer() As String
Dim i, y As Integer

For y = 0 To 50

i = UBound(buffArr)
buffArr(y) = y + 1 'toBeExec

Next

End Function

Private Sub execComm(exCom As String)

Dim toBeExec As String

toBeExec = exCom

If (toBeExec = "down") Then

Call DowN
Label3.Caption = "Truedown"
'timerGetFile.Enabled = False
End If

If (toBeExec = "up") Then
Call uP
Label3.Caption = "upTrue"

End If

If (toBeExec = "clockwise") Then

Call Clockwise
Label3.Caption = "clockwise"

End If

If (toBeExec = "counter clockwise") Then

Call counterClockwise
Label3.Caption = "counter clockwise"
End If

If (toBeExec = "") Then

Call brake
Label3.Caption = "brake"

End If

End Sub

Private Sub timerGetFile_Timer()

getFromTxt


End Sub

Private Sub txtSpeed_Change()

Dim speed As Integer

speed = Val(txtSpeed.Text)

Timer1.Interval = speed
Timer2.Interval = speed
Timer3.Interval = speed
Timer4.Interval = speed
End Sub

Is This A Good Question/Topic? 0
  • +

Replies To: controlling parallel port through web

#2 PsychoCoder  Icon User is offline

  • Google.Sucks.Init(true);
  • member icon

Reputation: 1641
  • View blog
  • Posts: 19,853
  • Joined: 26-July 07

Re: controlling parallel port through web

Posted 27 March 2008 - 11:30 PM

Please use code tags when posting code. They are used like so :code:
Was This Post Helpful? 0
  • +
  • -

#3 maca  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 8
  • Joined: 03-April 08

Re: controlling parallel port through web

Posted 06 April 2008 - 01:28 AM

hello man.

well i dont know anything about python, i want to learn somewhere in the future.

But i do have a friend who does, and he has controlled a microcontroler, trough serial, and parallel port over a website, with python using carrigel (is this how you spell it?).

Im sure he is willing to help you and provide his code (Hail! GPL!)

i dont know if i can post his e-mail but i will (if its wrong i can edit the post) but i will anyway. here it is:

phrozen10@gmail.com

Just tell him maca gave you his e-mail and he will help you.
:)

This post has been edited by maca: 06 April 2008 - 01:29 AM

Was This Post Helpful? 0
  • +
  • -

#4 .Maleficus.  Icon User is offline

  • D.I.C Head

Reputation: 2
  • View blog
  • Posts: 129
  • Joined: 07-March 08

Re: controlling parallel port through web

Posted 06 April 2008 - 07:45 PM

Is it just me, or is this neither Python nor Perl? Call me crazy, but it sure looks like VB.

This post has been edited by .Maleficus.: 06 April 2008 - 07:46 PM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1