PropWare
C++ objects and CMake build system for Parallax Propeller
Home
Download
Getting Started
Documentation
Reference
About
Related Links
Namespace List
Class List
File List
Examples
Build System
File List
File Members
propsideworkspace
Learn
Examples
ActivityBot
Whiskers Push Bot.c
1
/*
2
Whiskers Push Bot.c
3
4
Push the whiskers to make the ActivityBot back up.
5
6
http://learn.parallax.com/activitybot/whisker-wheel-response
7
*/
8
9
#include "simpletools.h"
// Include simpletools header
10
#include "
abdrive.h
"
// Include abdrive header
11
12
int
main
()
// main function
13
{
14
freqout(4, 2000, 3000);
// Speaker tone: 2 s, 3 kHz
15
16
while
(1)
17
{
18
// Check whisker states.
19
int
wL = input(7);
// Left whisker -> wL variable
20
int
wR = input(8);
// Right whisker -> wR variable
21
22
// If whisker pressed, back up
23
if
((wL == 0) || (wR == 0))
// Either whisker detects
24
{
25
drive_speed
(-64, -64);
// Back up
26
}
27
else
// Neither whisker detects
28
{
29
drive_speed
(0, 0);
// Stay still
30
}
31
}
32
}
abdrive.h
This library takes care of encoder monitoring and servo signalling, and provides a simple set of func...
main
int main(void)
Definition:
GraphicsTest.c:20
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, and makes causes the wheel to roll 3.25 mm.
Definition:
abdrive.c:417
Generated on Sat Aug 27 2016 00:58:03 for PropWare by
1.8.12