Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- Button Display.c
- Dislays the state of the P3 button in the SimpleIDE Terminal.
- 1 -> button pressed, 0 -> button not pressed.
- http://learn.parallax.com/propeller-c-simple-circuits/check-pushbuttons
- */
- #include "simpletools.h" // Include simpletools
- int main() // main function
- {
- while(1) // Endless loop
- {
- int button = input(5); // P3 input -> button variable
- printf("button = %d\n", button); // Display button state
- if(button == 1)
- {
- high(0);
- pause(50);
- low(0);
- pause(50);
- }
- else
- {
- high(1);
- pause(50);
- low(1);
- pause(50);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement