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
Devices
Sensor
Sound Impact
SoundImpactSensor OtherCog.c
1
/*
2
SoundImpactSensor OtherCog.c
3
4
Monitors and tracks number of sound impacts from another cog.
5
It's an extravagant use of a cog, but will simplify tracking if
6
the application has enough cogs available.
7
8
Connect: SIG to (R = 2.2 k) to P4, 5V to 5V, GND to GND
9
10
http://www.parallax.com/product/29132
11
*/
12
13
#include "simpletools.h"
// Include simpletools
14
#include "soundimpact.h"
// Include soundimpact
15
16
int
main
()
// Main function
17
{
18
print(
"Tracks sound impacts and \n"
);
// User prompt
19
print(
"updates every 3 seconds.\n"
);
20
21
soundImpact_run(4);
// Run in other cog
22
23
while
(1)
// Endless main loop
24
{
25
int
count = soundImpact_getCount();
// Get impact count
26
print(
"count = %d\n"
, count);
// Display
27
pause(3000);
// Wait 3 seconds
28
}
29
}
30
main
int main(void)
Definition:
GraphicsTest.c:20
Generated on Sat Aug 27 2016 00:58:03 for PropWare by
1.8.12