|
Revision 8183, 0.6 kB
(checked in by mootoh, 10 months ago)
|
|
add continuos read from dio.
|
| Line | |
|---|
| 1 | /* |
|---|
| 2 | * application example |
|---|
| 3 | * from http://8-p.info/gainer-ruby/ |
|---|
| 4 | */ |
|---|
| 5 | #include <iostream> |
|---|
| 6 | #include "gainer.h" |
|---|
| 7 | |
|---|
| 8 | using namespace std; |
|---|
| 9 | |
|---|
| 10 | int main(int argc, char **argv) { |
|---|
| 11 | if (argc != 2) { |
|---|
| 12 | cerr << "usage: ./gainer-button [device]" << endl; |
|---|
| 13 | exit(1); |
|---|
| 14 | } |
|---|
| 15 | |
|---|
| 16 | Gainer gainer(Gainer(argv[1], 1)); |
|---|
| 17 | gainer.continuous_digital_inputs(); |
|---|
| 18 | |
|---|
| 19 | for (int i(0); i<10; i++) { |
|---|
| 20 | usleep(100000); |
|---|
| 21 | |
|---|
| 22 | cout << "D: "; |
|---|
| 23 | for (size_t j(0); j<gainer.digital_inputs.size(); j++) { |
|---|
| 24 | cout << gainer.digital_inputs[j] << ' '; |
|---|
| 25 | } cout << endl; |
|---|
| 26 | |
|---|
| 27 | if (5 == i) |
|---|
| 28 | gainer.exit_continuos(); |
|---|
| 29 | } |
|---|
| 30 | sleep(1); |
|---|
| 31 | |
|---|
| 32 | return 0; |
|---|
| 33 | } |
|---|
| 34 | |
|---|