2014-05-06 14:27:16 +01:00
|
|
|
/*
|
|
|
|
* Author: Brendan Le Foll <brendan.le.foll@intel.com>
|
2015-01-07 17:15:55 -08:00
|
|
|
* Contributions: Sarah Knepper <sarah.knepper@intel.com>
|
2014-05-06 14:27:16 +01: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-05-06 14:27:16 +01:00
|
|
|
*
|
2019-07-30 19:41:32 -07:00
|
|
|
* SPDX-License-Identifier: MIT
|
2014-05-06 14:27:16 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <iostream>
|
2017-08-30 15:00:29 -07:00
|
|
|
|
2016-09-12 16:16:30 -07:00
|
|
|
#include "led.hpp"
|
2017-08-30 15:00:29 -07:00
|
|
|
#include "upm_utilities.h"
|
2014-05-06 14:27:16 +01:00
|
|
|
|
|
|
|
int
|
2017-08-30 15:00:29 -07:00
|
|
|
main(int argc, char** argv)
|
2014-05-06 14:27:16 +01:00
|
|
|
{
|
2017-08-30 15:00:29 -07:00
|
|
|
//! [Interesting]
|
2015-01-07 17:15:55 -08:00
|
|
|
|
|
|
|
// Create the Grove LED object using GPIO pin 2
|
2017-08-30 15:00:29 -07:00
|
|
|
upm::Led led(2);
|
2015-01-07 17:15:55 -08:00
|
|
|
|
|
|
|
// Print the name
|
2017-08-30 15:00:29 -07:00
|
|
|
std::cout << led.name() << std::endl;
|
2015-01-07 17:15:55 -08:00
|
|
|
|
|
|
|
// Turn the LED on and off 10 times, pausing one second
|
|
|
|
// between transitions
|
2017-08-30 15:00:29 -07:00
|
|
|
for (int i = 0; i < 10; i++) {
|
|
|
|
led.on();
|
|
|
|
upm_delay(1);
|
|
|
|
led.off();
|
|
|
|
upm_delay(1);
|
2014-05-06 14:27:16 +01:00
|
|
|
}
|
2015-01-07 17:15:55 -08:00
|
|
|
|
|
|
|
// Delete the Grove LED object
|
2017-08-30 15:00:29 -07:00
|
|
|
//! [Interesting]
|
2014-05-06 14:27:16 +01:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|