2014-11-24 17:41:27 -08:00
|
|
|
/*
|
|
|
|
* Author: Sarah Knepper <sarah.knepper@intel.com>
|
|
|
|
* 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-24 17:41:27 -08:00
|
|
|
*
|
2019-07-30 19:41:32 -07:00
|
|
|
* SPDX-License-Identifier: MIT
|
2014-11-24 17:41:27 -08:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <iostream>
|
2017-08-30 15:00:29 -07:00
|
|
|
|
2016-09-13 16:31:02 -07:00
|
|
|
#include "button.hpp"
|
2017-08-30 15:00:29 -07:00
|
|
|
#include "upm_utilities.h"
|
2014-11-24 17:41:27 -08:00
|
|
|
|
|
|
|
int
|
2017-08-30 15:00:29 -07:00
|
|
|
main(int argc, char** argv)
|
2014-11-24 17:41:27 -08:00
|
|
|
{
|
|
|
|
// This example uses GPIO 0
|
2017-08-30 15:00:29 -07:00
|
|
|
//! [Interesting]
|
2014-11-24 17:41:27 -08:00
|
|
|
|
|
|
|
// Create the button object using GPIO pin 0
|
2017-08-30 15:00:29 -07:00
|
|
|
upm::Button button(0);
|
2014-11-24 17:41:27 -08:00
|
|
|
|
|
|
|
// Read the input and print, waiting one second between readings
|
2017-08-30 15:00:29 -07:00
|
|
|
while (1) {
|
|
|
|
std::cout << button.name() << " value is " << button.value() << std::endl;
|
|
|
|
upm_delay(1);
|
2014-11-24 17:41:27 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
// Delete the button object
|
2017-08-30 15:00:29 -07:00
|
|
|
//! [Interesting]
|
2014-11-24 17:41:27 -08:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|