2015-02-26 09:14:41 -05:00
|
|
|
/*
|
|
|
|
* Author: Zion Orent <zorent@ics.com>
|
|
|
|
* Copyright (c) 2015 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.
|
2015-02-26 09:14:41 -05:00
|
|
|
*
|
2019-07-30 19:41:32 -07:00
|
|
|
* SPDX-License-Identifier: MIT
|
2015-02-26 09:14:41 -05:00
|
|
|
*/
|
|
|
|
#include <iostream>
|
|
|
|
#include <signal.h>
|
2017-08-30 15:00:29 -07:00
|
|
|
|
2016-09-08 12:35:41 -07:00
|
|
|
#include "emg.hpp"
|
2017-08-30 15:00:29 -07:00
|
|
|
#include "upm_utilities.h"
|
2015-02-26 09:14:41 -05:00
|
|
|
|
|
|
|
using namespace std;
|
|
|
|
|
|
|
|
int shouldRun = true;
|
|
|
|
|
2017-08-30 15:00:29 -07:00
|
|
|
void
|
|
|
|
sig_handler(int signo)
|
2015-02-26 09:14:41 -05:00
|
|
|
{
|
2017-08-30 15:00:29 -07:00
|
|
|
if (signo == SIGINT)
|
|
|
|
shouldRun = false;
|
2015-02-26 09:14:41 -05:00
|
|
|
}
|
|
|
|
|
2017-08-30 15:00:29 -07:00
|
|
|
int
|
|
|
|
main(int argc, char** argv)
|
2015-02-26 09:14:41 -05:00
|
|
|
{
|
2017-08-30 15:00:29 -07:00
|
|
|
signal(SIGINT, sig_handler);
|
|
|
|
|
|
|
|
//! [Interesting]
|
|
|
|
// The was tested with the EMG Muscle Signal Reader Sensor Module
|
|
|
|
// Instantiate a EMG on analog pin A0
|
|
|
|
upm::EMG emg(0);
|
|
|
|
cout << "Calibrating...." << endl;
|
|
|
|
emg.calibrate();
|
|
|
|
|
|
|
|
while (shouldRun) {
|
|
|
|
cout << emg.value() << endl;
|
|
|
|
upm_delay_us(100000);
|
|
|
|
}
|
|
|
|
|
|
|
|
//! [Interesting]
|
|
|
|
cout << "Exiting" << endl;
|
|
|
|
return 0;
|
2015-02-26 09:14:41 -05:00
|
|
|
}
|