PropWare  3.0.0.229
C++ objects and CMake build system for Parallax Propeller
servodiffdrive.c
1 #include "servodiffdrive.h" // Include servo lib funct defs
2 #include "servo.h"
3 
4 static int pinLeft, pinRight, rampLeft, rampRight; // Variables shared by functions
5 
6 void drive_pins(int left, int right) // drivePins function
7 {
8  pinLeft = left; // Local to global assignments
9  pinRight = right;
10 }
11 
12 void drive_speeds(int left, int right) // driveSpeeds function
13 {
14  servo_speed(pinLeft, left); // Use vals in servoSpeed calls
15  servo_speed(pinRight, -right);
16 }
17 
18 void drive_setramp(int left, int right) // driveRampSteps function
19 {
20  servo_setramp(pinLeft, left); // Use vals in rampStep calls
21  servo_setramp(pinRight, right);
22 }
23 
24 void drive_sleep() // driveSleep function
25 {
26  servo_set(pinLeft, 0); // Put servos to sleep
27  servo_set(pinRight, 0);
28 }
29 
30 void drive_stop() // driveStop function
31 {
32  servo_stop(); // Stop the servo processor
33 }
34 
servo_stop
void servo_stop(void)
Stops the servo process and frees a cog.
Definition: servo.c:197
drive_sleep
void drive_sleep()
Stops the drive wheel servo signals without stopping the processor that controls them.
Definition: servodiffdrive.c:24
servodiffdrive.h
Adds a layer over servo library for use with a differential servo drive robot. You have to add the si...
servo.h
Control up to 14 servos in another core. For up to 28, add the servoAux library to your project....
drive_pins
void drive_pins(int left, int right)
Set up left and right wheel servo pin connections.
Definition: servodiffdrive.c:6
servo_speed
int servo_speed(int pin, int speed)
Set Parallax Continuous Rotation servo speed.
Definition: servo.c:51
drive_speeds
void drive_speeds(int left, int right)
Set the servo drive speeds.
Definition: servodiffdrive.c:12
servo_set
int servo_set(int pin, int time)
Sets servo control signal to servo connected to a given pin for microsecond pulse durations.
Definition: servo.c:57
servo_setramp
int servo_setramp(int pin, int stepSize)
Set the maximum change in control signal a servo will change in a given 20 ms time period.
Definition: servo.c:100
drive_setramp
void drive_setramp(int left, int right)
Set the maximum ramp step size.
Definition: servodiffdrive.c:18
drive_stop
void drive_stop()
Stops the processor that controls all servos in the application.
Definition: servodiffdrive.c:30