Subject
- Posted on
whats going to happen if i use this code
- 09-11-2005
September 11, 2005, 6:33 pm
I am still fairly new to programing and i have a few ir rangers that i
want to use on my robot. I have hooked one of them up to the OOpic's
regulated supply voltage and i would like to know in advance if this
program could tell the servo's to move in two directions at once and
possibly screw them up
' This program reads the Sharp GP2D12 sensor
' It demonstrates the use of an oA2D object
' and an oDio1 object.
'this is an expiremental program that uses a singel ir ranger
' to make the
'robot turn left when it reaches something, i hope it works
'------------------------------------
Dim irf1 as new oA2D
Dim S1 As New oServo
Dim S2 As New oServo
Dim CenterPos As New oByte
Dim x as New oWord
Dim y as New oWord
'-----------------------------------------------------
Sub Main()
OOPic.Node = 1
CenterPos = 31
Call Setup
Do
S1 = CenterPos
S2 = CenterPos
Call GoRight
y = 100
Call Delay
Call GoForward
y = 100
Call Delay
Call GoLeft
y = 100
Call Delay
Loop
do
if irf1.value > 100 then
Call GoReverse
else
end if
loop
End Sub
Sub Setup()
S1.Ioline = 3
S1.Operate = cvTrue
S1.Center = CenterPos
S2.Ioline = 12
S2.Center = CenterPos
S2.Operate = cvTrue
S2.InvertOut = cvTrue
Oopic.ExtVRef=0
irf1.ioline=8
irf1.operate=cvtrue
End Sub
'--------------------------------------- -----------
Sub Delay()
For x = 1 To y:Next x
End Sub
Sub GoForward()
S1 = 0
S2 = 0
End Sub
Sub GoReverse()
S1 = 53
S2 = 53
y = 100
Call Delay
End Sub
Sub GoRight()
S1 = 53
S2 = 0
End Sub
Sub GoLeft()
S1 = 0
S2 = 53
End Sub
want to use on my robot. I have hooked one of them up to the OOpic's
regulated supply voltage and i would like to know in advance if this
program could tell the servo's to move in two directions at once and
possibly screw them up
' This program reads the Sharp GP2D12 sensor
' It demonstrates the use of an oA2D object
' and an oDio1 object.
'this is an expiremental program that uses a singel ir ranger
' to make the
'robot turn left when it reaches something, i hope it works
'------------------------------------
Dim irf1 as new oA2D
Dim S1 As New oServo
Dim S2 As New oServo
Dim CenterPos As New oByte
Dim x as New oWord
Dim y as New oWord
'-----------------------------------------------------
Sub Main()
OOPic.Node = 1
CenterPos = 31
Call Setup
Do
S1 = CenterPos
S2 = CenterPos
Call GoRight
y = 100
Call Delay
Call GoForward
y = 100
Call Delay
Call GoLeft
y = 100
Call Delay
Loop
do
if irf1.value > 100 then
Call GoReverse
else
end if
loop
End Sub
Sub Setup()
S1.Ioline = 3
S1.Operate = cvTrue
S1.Center = CenterPos
S2.Ioline = 12
S2.Center = CenterPos
S2.Operate = cvTrue
S2.InvertOut = cvTrue
Oopic.ExtVRef=0
irf1.ioline=8
irf1.operate=cvtrue
End Sub
'--------------------------------------- -----------
Sub Delay()
For x = 1 To y:Next x
End Sub
Sub GoForward()
S1 = 0
S2 = 0
End Sub
Sub GoReverse()
S1 = 53
S2 = 53
y = 100
Call Delay
End Sub
Sub GoRight()
S1 = 53
S2 = 0
End Sub
Sub GoLeft()
S1 = 0
S2 = 53
End Sub
Site Timeline
- » whats everybody's favorite parts distributer
- — Next thread in » General Robotics Forum
-

- » general vision software for a robot.
- — Previous thread in » General Robotics Forum
-

- » evoMUSART 2013: First CFP (with correct dates)
- — Newest thread in » General Robotics Forum
-

- » Zero On topic out of 11
- — The site's Newest Thread. Posted in » General Metalworking
-




