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

	
'********************************************************
'************Smaller Than Normal Mouse*******************
'Smaller Than Normal Mouse w/ Forward Sharp Sensor
'@ Version 1.0
'@ Author: Brian Patton
'@ Last Updated: April  17, 2004 
'********************************************************
'************* Declare Constants ************************

'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 Revers

'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)

Public Const Speed As Single = 0.02

Dim i As Integer
Dim Sensorvalue as Integer				' Value sensor receives
Dim Sensorave as Integer				' Average value of sensor

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

Sub Main()
Delay(3.0)
Do
		Call PulseOut(LeftServo, Left_Forward, 1)
		Call PulseOut(RightServo, Right_Forward, 1)
		Call CheckSensors()
		Delay(Speed)
loop
End Sub

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

Sub CheckSensors()

Sensorvalue = GetADC(IRPin)+GetADC(IRPin)+GetADC(IRPin)
					' Get three IR readings
Sensorave = Sensorvalue \ 3			' Devide them by 3 to get the average
					' Helps eliminate some error 
If Sensorave > 400 Then			' See if something is too close
	Call Right 			' Call right 
End If					' End of too close senario

If Sensorave < 200 Then	' See if something is too far like an edge
	Call Left 			' Call right 
End If					' End of too far senario

End Sub

'******************************************************
'****************** Turn Right ************************

Sub Right()
Dim i As Integer
		For i = 1 to 10

		Call PulseOut(LeftServo, Left_Reverse, 1)
		Call PulseOut(RightServo, Right_Reverse, 1)
		Delay(Speed)
	Next
	For i = 1 to 15
		Call PulseOut(LeftServo, Left_Reverse, 1)
		Call PulseOut(RightServo, Right_Forward, 1)
		Delay(Speed)
	Next
	
End Sub

'******************************************************
'****************** Turn Left *************************

Sub Left()

Dim i As Integer

	For i = 1 to 10
		Call PulseOut(LeftServo, Left_Reverse, 1)
		Call PulseOut(RightServo, Right_Reverse, 1)
		Delay(Speed)
	Next
	For i = 1 to 15
		Call PulseOut(LeftServo, Left_Forward, 1)
		Call PulseOut(RightServo, Right_Reverse, 1)
		Delay(Speed)
	Next
	
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.