PropWare
3.0.0.229
C++ objects and CMake build system for Parallax Propeller
Simple-Libraries
Learn
Simple Libraries
Robotics
ActivityBot360
libabdrive360
drive_ramp.c
1
/*
2
@file drive_ramp.c
3
4
@author Parallax Inc
5
6
@copyright
7
Copyright (C) Parallax Inc. 2017. All Rights MIT Licensed. See end of file.
8
9
@brief
10
*/
11
// // //
12
13
14
#include "
abdrive360.h
"
15
16
17
void
drive_ramp
(
int
left,
int
right)
18
{
19
drive_speed
(left, right);
20
21
while
(1)
22
{
23
int
speedL =
servo360_getSpeed
(abd360_pinCtrlLeft);
24
int
speedR =
servo360_getSpeed
(abd360_pinCtrlRight);
25
26
int
done = ( (speedL > (left - 4)) && (speedL < (left + 4)) );
27
done += ( (speedR > (right - 4)) && (speedR < (right + 4)) );
28
29
if
(done)
return
;
30
pause
(20);
31
}
32
}
33
34
servo360_getSpeed
int servo360_getSpeed(int pin)
Measure the current speed. For best results, take the average of multiple measurements.
Definition:
servo360_getSpeed.c:17
drive_speed
void drive_speed(int left, int right)
Set wheel speeds in encoder ticks per second. An encoder tick is 1/64th of a revolution,...
Definition:
speed.c:138
pause
void pause(int time)
Delay cog from moving on to the next statement for a certain length of time.
Definition:
libws2812.c:125
drive_ramp
void drive_ramp(int left, int right)
This function ramps up to a given speed and blocks execution until the speed is reached....
Definition:
ramp.c:7
abdrive360.h
This library provides a simple set of functions for making the ActivityBot 360 go certain distances a...
Generated on Fri May 20 2022 16:48:04 for PropWare by
1.8.17