libpruio
0.0
AM33xx-PRU driver for digital input / output and analog input
All
Classes
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Pages
1.bas
Go to the documentation of this file.
1
/'* \file 1.bas
2
\brief Example: minimal code for ADC input.
3
4
This file contains an short and simple example for text output of the
5
analog input lines. It's designed for the description pages and shows
6
the basic usage of libpruio with a minimum of source code, translatable
7
between FreeBASIC and C.
8
9
Licence: GPLv3
10
11
Copyright 2014 by Thomas{ dOt ]Freiherr[ At ]gmx[ DoT }net
12
13
14
Compile by:
15
16
fbc -w all 1.bas
17
18
'/
19
20
21
#INCLUDE ONCE
"../pruio/pruio.bi"
' include header
22
VAR
io
=
NEW
PruIo
()
'*< create new driver UDT
23
io
->config()
' upload (default) settings, start IO mode
24
25
'' now current ADC samples are available for AIN0 to AIN7 in array Value[]
26
27
FOR
n
AS INTEGER
= 1
TO 13
'' print some lines
28
FOR
i
AS INTEGER
= 1
TO 8
'' all steps
29
PRINT
" "
&
HEX
(
io
->Value[i], 4);
'' output one channel as hexadecimal
30
NEXT
31
PRINT
'' next line
32
NEXT
33
34
'' we're done
35
36
DELETE
io
' destroy driver UDT
37
src
examples
1.bas
Generated on Fri Jun 6 2014 12:23:36 for libpruio by
1.8.4