PropWare
3.0.0.229
C++ objects and CMake build system for Parallax Propeller
Simple-Libraries
Learn
Examples
Robots
ActivityBot360
Test Whiskers with Terminal.c
1
/*
2
Test Whiskers with Terminal.c
3
4
Display whisker states in terminal. 1 = not pressed, 0 = pressed.
5
*/
6
7
#include "
simpletools.h
"
// Include simpletools header
8
9
int
main
()
// main function
10
{
11
freqout
(4, 2000, 3000);
// Speaker tone: P4, 2 s, 3 kHz
12
while
(1)
// Endless loop
13
{
14
int
wL =
input
(7);
// Left whisker -> wL variable
15
int
wR =
input
(8);
// Right whisker -> wR variable
16
print
(
"%c"
,
HOME
);
// Terminal cursor home (top-left)
17
print
(
"wL = %d wR = %d"
, wL, wR);
// Display whisker variables
18
pause
(50);
// Pause 50 ms before repeat
19
}
20
}
HOME
#define HOME
HOME character (1) sends SimpleIDE Terminal's cursor to top-left "home" position.
Definition:
simpletools.h:233
freqout
void freqout(int pin, int msTime, int frequency)
Use same cog to send square wave of a certain frequency for a certain amount of time....
Definition:
freqout.c:10
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
Generated on Fri May 20 2022 16:48:04 for PropWare by
1.8.17