2014-11-06 10:24:56 -08:00
|
|
|
/*
|
2015-02-10 11:34:28 -08:00
|
|
|
* Author: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
|
2014-11-06 10:24:56 -08:00
|
|
|
* Copyright (c) 2014 Intel Corporation.
|
|
|
|
*
|
2019-07-30 19:41:32 -07:00
|
|
|
* This program and the accompanying materials are made available under the
|
|
|
|
* terms of the The MIT License which is available at
|
|
|
|
* https://opensource.org/licenses/MIT.
|
2014-11-06 10:24:56 -08:00
|
|
|
*
|
2019-07-30 19:41:32 -07:00
|
|
|
* SPDX-License-Identifier: MIT
|
2014-11-06 10:24:56 -08:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <iostream>
|
2017-08-30 15:00:29 -07:00
|
|
|
#include <stdint.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
|
2016-09-09 17:21:03 -07:00
|
|
|
#include "slide.hpp"
|
2017-08-30 15:00:29 -07:00
|
|
|
#include "upm_utilities.h"
|
2014-11-06 10:24:56 -08:00
|
|
|
|
|
|
|
using namespace std;
|
|
|
|
|
2017-08-30 15:00:29 -07:00
|
|
|
int
|
|
|
|
main()
|
2014-11-06 10:24:56 -08:00
|
|
|
{
|
2017-08-30 15:00:29 -07:00
|
|
|
//! [Interesting]
|
|
|
|
upm::Slide slide(0);
|
2014-11-06 10:24:56 -08:00
|
|
|
|
2017-08-30 15:00:29 -07:00
|
|
|
cout << slide.name() << endl;
|
2014-11-06 10:24:56 -08:00
|
|
|
|
2017-08-30 15:00:29 -07:00
|
|
|
while (true) {
|
|
|
|
float adc_value = slide.raw_value(); // Read raw value
|
|
|
|
float volts = slide.voltage_value(); // Read voltage, board reference set at 5.0V
|
|
|
|
fprintf(stdout, "%4d = %.2f V\n", (uint16_t) adc_value, volts);
|
2014-11-06 10:24:56 -08:00
|
|
|
|
2017-08-30 15:00:29 -07:00
|
|
|
upm_delay_us(2500000); // Sleep for 2.5s
|
2014-11-06 10:24:56 -08:00
|
|
|
}
|
2017-08-30 15:00:29 -07:00
|
|
|
//! [Interesting]
|
2014-11-06 10:24:56 -08:00
|
|
|
return 0;
|
|
|
|
}
|