PropWare
3.0.0.229
C++ objects and CMake build system for Parallax Propeller
Simple-Libraries
Learn
Examples
Circuits
Count Transitions.c
1
/*
2
Count Transitions.c
3
4
Flash P26 at 10 Hz for 10 seconds. After 1 s, count transitions for 1 s
5
and report the count.
6
7
http://learn.parallax.com/propeller-c-tutorials
8
*/
9
10
#include "
simpletools.h
"
// Include simpletools
11
12
int
main
()
// main function
13
{
14
square_wave
(26, 0, 10);
// P26, ch0, 10 Hz.
15
pause
(1000);
// Pause 1 second
16
17
int
cycles =
count
(26, 1000);
// Count for 1 second
18
print
(
"cycles = %d\n"
, cycles);
// Report on/off cycles
19
20
// Negative pin clears signal and lets go of I/O pin.
21
square_wave
(-26, 0, 0);
22
}
23
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
count
long count(int pin, long duration)
Count number of low to high transitions an external input applies to an I/O pin over a certain period...
Definition:
count.c:19
square_wave
void square_wave(int pin, int channel, int freq)
Make I/O pin transmit a repeated high/low signal at a certain frequency. High and low times are the s...
Definition:
squareWave.c:38
Generated on Fri May 20 2022 16:48:04 for PropWare by
1.8.17