PropWare
3.0.0.229
C++ objects and CMake build system for Parallax Propeller
Simple-Libraries
Learn
Examples
Robots
ActivityBot360
Test Feedback Connections.c
1
/*
2
Test Feedback Connections.c
3
4
Load to ActivityBot EEPROM. PWR to Position 2.
5
Gently turn each wheel by hand. Right wheel
6
blinks P27 LED, left wheel blinks P26 LED.
7
8
http://learn.parallax.com/activitybot/test-feedback-360-servos
9
*/
10
11
//
12
#include "
simpletools.h
"
// Library - simpletools
13
#include "
abdrive360.h
"
// Library - abdrive360
14
15
int
left;
// Current/previous angles
16
int
right;
17
int
leftPrev;
18
int
rightPrev;
19
20
int
main
()
// Main function
21
{
22
drive_getTicks
(&left, &right);
// Get current encoder ticks
23
leftPrev = left;
// Set previous values
24
rightPrev = right;
25
26
while
(1)
// Main loop
27
{
28
drive_getTicks
(&left, &right);
// Get current encoder ticks
29
if
(left != leftPrev)
// If left different from previous
30
{
31
toggle
(26);
// Toggle P26 LED light
32
}
33
34
if
(right != rightPrev)
// If right different from previous
35
{
36
toggle
(27);
// Toggle P27 LED light
37
}
38
39
leftPrev = left;
// Save previous values
40
rightPrev = right;
41
}
42
}
43
drive_getTicks
void drive_getTicks(int *left, int *right)
Get the measured number of ticks the have traveled.
Definition:
getticks.c:9
simpletools.h
This library provides convenient functions for a variety of microcontroller I/O, timing,...
main
int main(void)
Definition:
GraphicsTest.c:20
abdrive360.h
This library provides a simple set of functions for making the ActivityBot 360 go certain distances a...
toggle
unsigned int toggle(int pin)
Toggle the output state of the I/O pin.
Definition:
toggle.c:19
Generated on Fri May 20 2022 16:48:04 for PropWare by
1.8.17