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
Test Whiskers with LEDs.c
1
/*
2
Test Whiskers with LEDs.c
3
4
Display whisker states in terminal. 1 = not pressed, 0 = pressed.
5
6
http://learn.parallax.com/activitybot/add-whisker-indicator-lights
7
*/
8
9
#include "simpletools.h"
// Include simpletools header
10
11
int
main
()
// main function
12
{
13
freqout(4, 2000, 3000);
// Speaker tone: P4, 2 s, 3 kHz
14
while
(1)
// Endless loop
15
{
16
int
wL = input(7);
// Left whisker -> wL variable
17
int
wR = input(8);
// Right whisker -> wR variable
18
if
(wL == 0) high(26);
else
low(26);
// Light for left whisker
19
if
(wR == 0) high(27);
else
low(27);
// Light for right whisker
20
print(
"%c"
, HOME);
// Terminal cursor home (top-left)
21
print(
"wL = %d wR = %d"
, wL, wR);
// Display whisker variables
22
pause(50);
// Pause 50 ms before repeat
23
}
24
}
main
int main(void)
Definition:
GraphicsTest.c:20
Generated on Sat Aug 27 2016 00:58:03 for PropWare by
1.8.12