mirror of
https://github.com/eclipse/upm.git
synced 2025-03-24 01:10:22 +03:00
grove: added comments to Grove LED C++ example
Signed-off-by: Sarah Knepper <sarah.knepper@intel.com>
This commit is contained in:
parent
49d25b1791
commit
535230084e
@ -1,5 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Author: Brendan Le Foll <brendan.le.foll@intel.com>
|
* Author: Brendan Le Foll <brendan.le.foll@intel.com>
|
||||||
|
* Contributions: Sarah Knepper <sarah.knepper@intel.com>
|
||||||
* Copyright (c) 2014 Intel Corporation.
|
* Copyright (c) 2014 Intel Corporation.
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining
|
* Permission is hereby granted, free of charge, to any person obtaining
|
||||||
@ -30,14 +31,24 @@ int
|
|||||||
main(int argc, char **argv)
|
main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
//! [Interesting]
|
//! [Interesting]
|
||||||
|
|
||||||
|
// Create the Grove LED object using GPIO pin 2
|
||||||
upm::GroveLed* led = new upm::GroveLed(2);
|
upm::GroveLed* led = new upm::GroveLed(2);
|
||||||
|
|
||||||
|
// Print the name
|
||||||
std::cout << led->name() << std::endl;
|
std::cout << led->name() << std::endl;
|
||||||
|
|
||||||
|
// Turn the LED on and off 10 times, pausing one second
|
||||||
|
// between transitions
|
||||||
for (int i=0; i < 10; i++) {
|
for (int i=0; i < 10; i++) {
|
||||||
led->on();
|
led->on();
|
||||||
sleep(1);
|
sleep(1);
|
||||||
led->off();
|
led->off();
|
||||||
sleep(1);
|
sleep(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Delete the Grove LED object
|
||||||
|
delete led;
|
||||||
//! [Interesting]
|
//! [Interesting]
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user