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
'******************************************************
'Modified for the Smaller than Normal Mouse By
'Brian Patton (brianp@robodyssey.com)
'Last updated on April 17 2004
'******************************************************
Option Explicit

'Each Servo may be slightly different but these two are:
'Left center is 0.00183, Slow Forward is .00175  Fast Forward = 0.00165 
'Right Center = 0.0018, Slow Forward is .0019  Fast Forward = 0.002


Public Const Left_Forward As Single = 0.00165
Public Const Right_Forward As Single = 0.002 	'Bigger Faster 

Public Const Left_Reverse As Single = 0.00195	'Bigger Faster Reverse
Public Const Right_Reverse As Single = 0.0017	'Smaller Faster Reverse

'Servo Pins
Public Const LeftServo As Byte = 5
Public Const RightServo As Byte = 6

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

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

Sub Main()
Delay(3.0) ' Give me a chance to let go!
	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) < 150
		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) > 400
		' 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.