|
Revision 8189, 0.7 kB
(checked in by mootoh, 5 years ago)
|
|
lang/cplusplus/gainer++: add continuos analog input example.
|
| Line | |
|---|
| 1 | /* |
|---|
| 2 | * continuous analog input read |
|---|
| 3 | */ |
|---|
| 4 | #include <iostream> |
|---|
| 5 | #include "gainer.h" |
|---|
| 6 | |
|---|
| 7 | using namespace std; |
|---|
| 8 | |
|---|
| 9 | int main(int argc, char **argv) { |
|---|
| 10 | if (argc != 2) { |
|---|
| 11 | cerr << "usage: ./gainer-cain [device]" << endl; |
|---|
| 12 | exit(1); |
|---|
| 13 | } |
|---|
| 14 | |
|---|
| 15 | Gainer gainer(Gainer(argv[1], 1)); |
|---|
| 16 | gainer.continuous_analog_inputs(); |
|---|
| 17 | cout << "hoge" << endl; |
|---|
| 18 | |
|---|
| 19 | for (int i(0); i<100; i++) { |
|---|
| 20 | cout << "A: "; |
|---|
| 21 | /* |
|---|
| 22 | for (size_t j(0); j<gainer.analog_inputs.size(); j++) { |
|---|
| 23 | cout << gainer.analog_inputs[j] << ' '; |
|---|
| 24 | } cout << endl; |
|---|
| 25 | */ |
|---|
| 26 | cout << gainer.analog_inputs[2]-127 << ' '; |
|---|
| 27 | cout << endl; |
|---|
| 28 | |
|---|
| 29 | //if (5 == i) |
|---|
| 30 | //gainer.exit_continuos(); |
|---|
| 31 | usleep(100000); |
|---|
| 32 | } |
|---|
| 33 | sleep(1); |
|---|
| 34 | |
|---|
| 35 | return 0; |
|---|
| 36 | } |
|---|
| 37 | |
|---|