libpruio  0.6.8
Fast and easy Digital/Analog Input/Output for Beaglebones
button.bas
Go to the documentation of this file.
1 
16 
17 ' include libpruio
18 #INCLUDE ONCE "BBB/pruio.bi"
19 ' include the convenience macros for header pins
20 #INCLUDE ONCE "BBB/pruio_pins.bi"
21 
22 
23 #DEFINE PIN P8_07
24 
25 ' ***** main *****
26 
27 VAR io = NEW PruIo
28 
29 WITH *io
30  DO
31  IF .Errr THEN ?"initialisation failed (" & *.Errr & ")" : EXIT DO
32  IF .config() THEN ?"config failed (" & *.Errr & ")" : EXIT DO
33  DO ' print current state (until keystroke)
34  ?!"\r" & .Gpio->Value(PIN);
35  SLEEP 100
36  LOOP UNTIL LEN(INKEY()) : ?
37  LOOP UNTIL 1
38 
39  IF .Errr THEN ?"press any key to quit" : SLEEP
40 END WITH
41 
42 DELETE io ' reset ADC, PinMux and GPIOs, clear memory
43 
44 '' help Doxygen to document the main code
45 '&/** The main function. */
46 '&int main() {PruIo::PruIo(); GpioUdt::config(); PruIo::config(); GpioUdt::Value(); PruIo::~PruIo();}
47