Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Mattias Fält
moberg
Commits
2dffac9d
Commit
2dffac9d
authored
May 16, 2019
by
Anders Blomdell
Browse files
Simple C example
parent
36b9204d
Changes
1
Hide whitespace changes
Inline
Side-by-side
examples/dump_analogin.c
0 → 100644
View file @
2dffac9d
#include
<moberg.h>
int
main
(
int
argc
,
char
*
argv
)
{
struct
moberg
*
moberg
=
moberg_new
();
for
(
int
i
=
0
;
i
<
500
;
i
++
)
{
struct
moberg_analog_in
analog_in
;
struct
moberg_status
status
;
double
value
;
status
=
moberg_analog_in_open
(
moberg
,
i
,
&
analog_in
);
if
(
moberg_OK
(
status
))
{
status
=
analog_in
.
read
(
analog_in
.
context
,
&
value
);
if
(
moberg_OK
(
status
))
{
printf
(
"%03d: %f
\n
"
,
i
,
value
);
}
}
status
=
moberg_analog_in_close
(
moberg
,
i
,
analog_in
);
}
moberg_free
(
moberg
);
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment