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 IR Detectors.c
1
/*
2
Test IR Detectors.c
3
4
Test IR LEDs and IR receivers used together as object detectors.
5
6
http://learn.parallax.com/activitybot/test-ir-sensor-circuits
7
*/
8
9
#include "simpletools.h"
// Include simpletools
10
11
int
irLeft, irRight;
// Global variables
12
13
int
main
()
// Main function
14
{
15
low(26);
// D/A0 & D/A1 to 0 V
16
low(27);
17
18
while
(1)
// Main loop
19
{
20
freqout(11, 1, 38000);
// Left IR LED light
21
irLeft = input(10);
// Check left IR detector
22
23
freqout(1, 1, 38000);
// Repeat for right detector
24
irRight = input(2);
25
26
print(
"%c irLeft = %d, irRight = %d"
,
// Display detector states
27
HOME, irLeft, irRight);
28
pause(100);
// Pause before repeating
29
}
30
}
31
main
int main(void)
Definition:
GraphicsTest.c:20
Generated on Sat Aug 27 2016 00:58:03 for PropWare by
1.8.12