PropWare
3.0.0.229
C++ objects and CMake build system for Parallax Propeller
Simple-Libraries
Learn
Examples
Circuits
Sense Light.c
1
/*
2
Sense Light.side
3
4
Display light sensor levels.
5
6
http://learn.parallax.com/propeller-c-simple-circuits/sense-light
7
*/
8
9
#include "
simpletools.h
"
// Include simpletools
10
11
int
main
()
// main function
12
{
13
while
(1)
// Endless loop
14
{
15
high
(5);
// Set P5 high
16
pause
(1);
// Wait for circuit to charge
17
int
t =
rc_time
(5, 1);
// Measure decay time on P5
18
print
(
"t = %d\n"
, t);
// Display decay time
19
pause
(100);
// Wait 1/10th of a second
20
}
21
}
22
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
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