ROBODYSSEY SYSTEMS LLC

Product Catalog
Code Page
Policies
Gallery
Whats New
Press Releases
Resources
Links
Contact Us
About Us
Press

Home Product Catalog Shopping Cart Resources Links
Code Page Policies Gallery

'******************************************************
'***************** FOLLOWME1IR *************************
'IR Follow the Leader - ONE Sharp Infrared Detector (GP2D12)
'@ Platform: NetMedia BasicX 24
'@ Version: 2.0
'@ Author: Chris D. Odom (chris_odom@georgeschool.org)
' Robodyssey Systems, LLC. - www.robodyssey.com
'@ Last Updated: July 25, 2003

'******************************************************
'The Robodyssey Mouse uses ONE front mounted IR sensor to
'follow anything in front of it. Best when a book or other
'flat object is in front of Mouse.
'******************************************************
'May be freely distributed and modified, but must contain above information

Option Explicit

' The servos think 0.0015 is where it always is. So sending the servo a pulse width
' above or below that value makes the servo move forward or backward.
Public Const Left_Forward As Single = 0.001
Public Const Right_Forward As Single = 0.002
Public Const Left_Reverse As Single = 0.002
Public Const Right_Reverse As Single = 0.001

'Servo Pins
Public Const LeftServo As Byte = 5 ' (Pin #1 on RAMB)
Public Const RightServo As Byte = 6 ' (Pin #0 on RAMB)

'IR Pin
Const IRPin As Byte = 13 ' (Pin #8 on RAMB)

'******************************************************
'****************** Start of Main Loop ****************

Sub Main()
Do
' move forward
Call PulseOut(RightServo, Right_Forward, 3)
Call PulseOut(LeftServo, Left_Forward, 3)

' Check the sensor to see if anything is in front of the Mouse
Call CheckSensors()
Delay(0.0)
Loop
End Sub

'******************************************************
'****************** Check Sensors *********************

Sub CheckSensors()
' Mouse will turn left until something is in front of it
Do while GetADC(IRPin) < 100
debug.print "No reflection!"

' turn left
Call PulseOut(LeftServo, Left_Forward, 1)
Call PulseOut(RightServo, Right_Reverse, 1)
Delay(0.08)
Loop

' Stop moving when Mouse gets too close to object
Do while GetADC(IRPin) > 300
' Stop
debug.print "Stop"
call putpin(25,0) ' turn red light on
Loop


call putpin(25,1) ' turn red light off

' Print current IR reading
debug.print "IR Reading: " & CStr(GetADC(IRPin))

End Sub


Home Product Catalog Shopping Cart Resources Links
Code Page Policies Gallery

Robodyssey Systems manufactures Robot Kits including Autonomous Mobile Walking Robots, Wheeled Robots, Talking Robots, Expressive Robots, and Social Robots. We also sell Robotics Accessories including Nexcell NiMH AA Rechargeable Batteries, Nexcell NiMH AAA Rechargeable Batteries, Battery Holders, Velcro Straps for Battery Packs, Battery Chargers, Robot Grippers, Hobby Servos, Servos Modified for Continuous Rotation, Tail Wheels for all Rolling Robotic Platforms, Polyurethane Skate Wheels with Servo Adapter Hubs, Sharp IR Sensors and Adjustable Sensor Brackets, Sensor Cables, and Programming Cables. All of our Robot Kits can be purchased as easy to assemble robot kits or as fully assembled stationary or mobile robots. Robodyssey uses 1/8 inch aluminum and acetyl for most all of our mobile robot components and robotics accessories. We provide classroom training for teachers interested in integrating robotics, computer programming and electronics into the classroom.

We hope you enjoy our web site. Feel free to use any robotic resources. Robodyssey is your complete solution for Educational Robotics as well as Hobby Robotics.