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 OtherCogFeatures.c
1
/*
2
SoundImpactSensor OtherCogFeatures.c
3
4
Expands on "SoundImpactSensor OtherCog" by demonstrating cog run
5
and end features.
6
7
Connect: SIG to (R = 2.2 k) to P4, 5V to 5V, GND to GND
8
9
http://www.parallax.com/product/29132
10
*/
11
12
#include "simpletools.h"
// Include simpletools
13
#include "soundimpact.h"
// Include soundimpact
14
15
int
main
()
// Main function
16
{
17
print(
"Tracks sound impacts and \n"
);
// User prompt
18
print(
"updates every 3 seconds.\n"
);
19
20
int
*cog = soundImpact_run(4);
// Run in other cog
21
22
// Check 10 times, every 3 seconds.
23
for
(
int
s = 0; s < 30; s += 3)
// Count to 30 in steps of 3
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
print(
"Ending sound impact cog.\n"
);
// User info
31
print(
"Cog is now free for other\n"
);
32
print(
"process.\n"
);
33
34
soundImpact_end(cog);
// Stop sound impact cog
35
}
36
main
int main(void)
Definition:
GraphicsTest.c:20
Generated on Sat Aug 27 2016 00:58:03 for PropWare by
1.8.12