// // "Hello World" example for the Crandun Technologies CTI-AR600 software library. // Copyright (c) 2001, Crandun Technologies Inc. // #include "CTI_AR600.h" // required header #include // needed for cout using namespace std; // we use cout and cerr using namespace Crandun; // all library symbols are in this namespace int main() { char c; long rc; const int maxSamples = 20; float fullScaleSpan, rangeData[maxSamples]; CTI_AR600 my_AR600; cout << "Crandun Technologies CTI-AR600 Library 'Hello World' example." << endl; cout << "Enter the Full Scale Span of the sensor you are using (e.g. 4.0): "; cin >> fullScaleSpan; rc = my_AR600.setCommOpen("COM1:", 9600, fullScaleSpan); if (rc != CTI_SUCCESS) { cerr << "ERROR: setCommParams returned error: " << rc << endl; return -1; } cout << "Reading samples from sensor ..." << endl; rc = my_AR600.getSamples(rangeData, maxSamples, 10, 3000); if (rc < 0) { cerr << "ERROR: getSamples returned error: " << rc << endl; my_AR600.setCommClosed(); return -1; } cout << "Read " << rc << " range samples from the sensor." << endl; for (int i = 0; i < rc; i++) cout << "Range " << i << " is " << rangeData[i] << endl; cout << my_AR600.getNumBytesSkipped() << " bytes of data were skipped." << endl; my_AR600.setCommClosed(); cout << "Please enter any character to exit: "; cin >> c; return 0; }