PropWare
3.0.0.229
C++ objects and CMake build system for Parallax Propeller
Simple-Libraries
Learn
Examples
Circuits
Button Display.c
1
/*
2
Button Display.c
3
4
Dislays the state of the P3 button in the SimpleIDE Terminal.
5
1 -> button pressed, 0 -> button not pressed.
6
7
http://learn.parallax.com/propeller-c-simple-circuits/check-pushbuttons
8
*/
9
10
#include "
simpletools.h
"
// Include simpletools
11
12
int
main
()
// main function
13
{
14
while
(1)
// Endless loop
15
{
16
int
button
=
input
(3);
// P3 input -> button variable
17
print
(
"button = %d\n"
,
button
);
// Display button state
18
pause
(100);
// Wait 0.1 second before repeat
19
}
20
}
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
input
int input(int pin)
Set an I/O pin to input and return 1 if pin detects a high signal, or 0 if it detects low.
Definition:
input.c:19
button
int button(int pad)
Gets the state of a touch button (1) pressed, (0) not pressed. Numbering {6, 5, 4,...
Definition:
jm_touchpads.c:70
Generated on Fri May 20 2022 16:48:04 for PropWare by
1.8.17