this is a stupid question, but i need to find the answer

Jul 16, 2005 4 Replies

i have been trying to interface a simple on or off bumper with an oopic for a couple weeks now, the oopic website is worthless and the closest it got was telling me how to interface a led. i have an oopicI and i am new to robotics, could someone please help! (Code examples would be nice)



by the way, i need the code in oopic's version of basic

thanks in advance

Hi MR

Have you got the OOPIC book "Programming and Customizing the OOPic Microcontroller : The Official OOPic Handbook (TAB Robotics)"? Check out Amazon.com. From what I have heard, it is the best reference around.

:- ]

Cheers

Dale

I understand how to program add a bumper into the list of objects, just not how to make the robot carry out a left turn when it hits something these are my two attempts

1.------------------------------------------------------------- (It is not done yet) 'this is an expiremental program that uses a singel bumper to make the 'robot turn left when it hits something, i hope it works

Dim Front AS New oDio1

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() CenterPos = 31 Call Setup Do Call GoRight y = 100 Call Delay

Call GoForward y = 100 Call Delay

Call GoReverse y = 100 Call Delay Loop End Sub '----------------------- Sub Setup() Front.Direction = cvInput Front.IOLine = 6

S1.Ioline = 3 S1.Operate = cvTrue S1.Center = CenterPos

S2.Center = CenterPos S2.Operate = cvTrue S2.Ioline = 12 S2.InvertOut = cvTrue

End Sub

Sub turnleft_Code() S1 = 53 S2 = 0 y = 100 Call Delay 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 End Sub

Sub GoRight() S1 = 53 S2 = 0 End Sub

2.------------------------------------------------------------------------(not shure how this is supposed to work, but the manual told me to do this and it didn't work)

'this is an expiremental program that uses a singel bumper to make the 'robot turn left when it hits something, i hope it works

Dim turnleft As New oEvent Dim frontbumper As New oDio1 Dim WIRE As New oGate Dim oofb As New oDio1

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() CenterPos = 31 Call Setup Do Call GoRight y = 100 Call Delay

Call GoForward y = 100 Call Delay

Call GoReverse y = 100 Call Delay Loop End Sub '----------------------- Sub Setup() frontbumper.Ioline = 6 frontbumper.direction = cvInput WIRE.Input1.Link(frontbumper) WIRE.Output.Link(turnleft.Operate)

oofb.Ioline = 20 oofb.direction = cvOutput oofb.Value = 1

S1.Ioline = 3 S1.Operate = cvTrue S1.Center = CenterPos

S2.Center = CenterPos S2.Operate = cvTrue S2.Ioline = 12 S2.InvertOut = cvTrue

End Sub

Sub turnleft_Code() S1 = 53 S2 = 0 y = 100 Call Delay 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 End Sub

Sub GoRight() S1 = 53 S2 = 0 End Sub

2.------------------------------------------------------------------------(n ot

Checkout the yahoo oopic forum. Your questions will be answered there. Suggest using the oopic.delay = x if you want some consistency.

Ian

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required