PropWare
3.0.0.229
C++ objects and CMake build system for Parallax Propeller
Simple-Libraries
Learn
Examples
Robots
ActivityBot360
Test Light Sensors.c
1
/*
2
Test Light Sensors.c
3
4
http://learn.parallax.com/activitybot/build-light-sensor-circuits
5
*/
6
7
#include "
simpletools.h
"
8
9
int
lightLeft, lightRight;
10
11
int
main
()
12
{
13
while
(1)
14
{
15
high
(9);
16
pause
(1);
17
lightLeft =
rc_time
(9, 1);
18
19
high
(5);
20
pause
(1);
21
lightRight =
rc_time
(5, 1);
22
23
print
(
"%clightLeft = %d, lightRight = %d%c"
,
24
HOME
, lightLeft, lightRight,
CLREOL
);
25
pause
(250);
26
}
27
}
HOME
#define HOME
HOME character (1) sends SimpleIDE Terminal's cursor to top-left "home" position.
Definition:
simpletools.h:233
pause
void pause(int time)
Delay cog from moving on to the next statement for a certain length of time.
Definition:
libws2812.c:125
simpletools.h
This library provides convenient functions for a variety of microcontroller I/O, timing,...
print
int print(const char *format,...) __attribute__((format(printf
Print format "..." args to the default simple terminal device. The output is limited to 256 bytes.
main
int main(void)
Definition:
GraphicsTest.c:20
rc_time
long rc_time(int pin, int state)
Set I/O pin to input and measure the time it takes a signal to transition from a start state to the o...
Definition:
rcTime.c:19
CLREOL
#define CLREOL
CLREOL character (11) erases all SimpleIDE Terminal characters to the right of the cursor.
Definition:
simpletools.h:323
high
void high(int pin)
Set an I/O pin to output-high.
Definition:
high.c:19
Generated on Fri May 20 2022 16:48:04 for PropWare by
1.8.17