PropWare
3.0.0.229
C++ objects and CMake build system for Parallax Propeller
Simple-Libraries
Learn
Simple Libraries
Sensor
libping
ping.c
1
#include "
simpletools.h
"
2
3
int
ping
(
int
pin)
4
{
5
pause
(1);
6
low
(pin);
7
pulse_out
(pin, 10);
8
return
pulse_in
(pin, 1);
9
}
10
11
int
ping_cm
(
int
pin)
12
{
13
long
tEcho =
ping
(pin);
14
int
cmDist = tEcho / 58;
15
return
cmDist;
16
}
17
18
int
ping_inches
(
int
pin)
19
{
20
long
tEcho =
ping
(pin);
21
int
inDist = tEcho / 148;
22
return
inDist;
23
}
ping_cm
int ping_cm(int pin)
Report Ping))) measurement as a centimeter distance.
Definition:
ping.c:11
ping_inches
int ping_inches(int pin)
Report Ping))) measurement as an inch distance.
Definition:
ping.c:18
pause
void pause(int time)
Delay cog from moving on to the next statement for a certain length of time.
Definition:
libws2812.c:125
low
void low(int pin)
Set an I/O pin to output-low.
Definition:
low.c:19
simpletools.h
This library provides convenient functions for a variety of microcontroller I/O, timing,...
pulse_in
long pulse_in(int pin, int state)
Measure the duration of a pulse applied to an I/O pin.
Definition:
pulseIn.c:19
pulse_out
void pulse_out(int pin, int time)
Transmit a pulse with an I/O pin.
Definition:
pulseOut.c:19
ping
int ping(int pin)
Measure echo time in terms of Propeller system clock ticks.
Definition:
ping.c:3
Generated on Fri May 20 2022 16:48:05 for PropWare by
1.8.17