PropWare
3.0.0.229
C++ objects and CMake build system for Parallax Propeller
Simple-Libraries
Learn
Examples
Robots
Arlo
Arlo - Serial through arlodrive.c
1
/*
2
Arlo - Serial through arlodrive.c
3
*/
4
5
#include "
simpletools.h
"
// Include simple tools
6
#include "arlodrive.h"
7
8
char
*reply;
9
10
int
main
()
// Main function
11
{
12
print
(
"SPEED & DISTANCE\n\n"
);
13
print
(
"To DHB-10 From DHB-10\n"
);
14
print
(
"------------- ----------------\n"
);
15
16
print
(
"RST\\r "
);
17
reply = dhb10_com(
"RST\r"
);
18
if
(*reply ==
'\r'
)
print
(
"\\r\n"
);
19
else
print
(
"%s"
, reply);
20
21
print
(
"gospd 32 32\\r "
);
22
reply = dhb10_com(
"gospd 32 32\r"
);
23
if
(*reply ==
'\r'
)
print
(
"\\r\n"
);
24
else
print
(
"%s"
, reply);
25
26
pause
(2000);
27
28
print
(
"gospd 0 0\\r "
);
29
reply = dhb10_com(
"gospd 0 0\r"
);
30
if
(*reply ==
'\r'
)
print
(
"\\r\n"
);
31
else
print
(
"%s"
, reply);
32
33
// Display distance reply as text
34
print
(
"dist\\r "
);
35
reply = dhb10_com(
"dist\r"
);
36
if
(*reply ==
'\r'
)
print
(
"\\r\n"
);
37
else
print
(
"%s"
, reply);
38
39
print
(
"------------- ----------------\n"
);
40
41
// Convert distance reply text to numeric values to use in
42
// calculations, and display the results stored by int variables.
43
int
countLeft, countRight;
44
print
(
"\nVARIABLE VALUES\n"
, reply);
45
sscan
(reply,
"%d%d"
, &countLeft, &countRight);
46
print
(
"countLeft = %d, countright = %d\n"
, countLeft, countRight);
47
}
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
sscan
int int int int sscan(const char *buffer, const char *fmt,...) __attribute__((format(printf
Convert formatted buffer to the "..." args.
Generated on Fri May 20 2022 16:48:04 for PropWare by
1.8.17