|
Option Explicit
Const TurretServo As Byte = 20 '(Pin20 on the RAMB)
Const TurretServoLeft As Single = 0.001
Const TurretServoMid As Single = 0.0016
Const TurretServoRight As Single = 0.0023
Const ServoSleep As Single = 0.03
Const ServoPulses As Integer = 12
Const TurretSensorPin As Byte = 13
Dim TurretModifier as Single ' Amount the servo moves between pulses
Dim TurretPosition as Single ' Position of the sensor
Dim TurretConv as Single
Dim TurretStack (1 To 96) As Byte
'********************************
Public Sub Main ()
TurretPosition = TurretServoLeft
Dim s as Integer
For s = 1 to 20
Call PulseOut(TurretServo, TurretPosition, 1)
Call Delay(0.02)
Next
TurretModifier = 0.00001
Sleep (3.0)
CallTask "RotateTurret", TurretStack
End Sub
'********************************************************
'************* Rotate Turret Task ***********************
Sub RotateTurret()
Dim z as Integer
Do
TurretPosition = TurretPosition + TurretModifier
If TurretPosition < TurretServoLeft Then
TurretModifier = 0.00001
ElseIf TurretPosition > TurretServoRight Then
TurretModifier = -0.00001
End If
Call PulseOut(TurretServo, TurretPosition, 1)
TurretConv = TurretPosition * 100000.00
z = FixI(TurretConv)
Debug.Print CStr(Z); ", "; Cstr(GetADC(13))
Delay(0.02)
Delay(0.1)
Loop
End Sub
|
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.
|