From 535230084eaaa0e9f4dcba03864d9a350bda2dcd Mon Sep 17 00:00:00 2001 From: sknepper Date: Wed, 7 Jan 2015 17:15:55 -0800 Subject: [PATCH] grove: added comments to Grove LED C++ example Signed-off-by: Sarah Knepper --- examples/groveled.cxx | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/examples/groveled.cxx b/examples/groveled.cxx index 25a4ba33..52d5e849 100644 --- a/examples/groveled.cxx +++ b/examples/groveled.cxx @@ -1,5 +1,6 @@ /* * Author: Brendan Le Foll + * Contributions: Sarah Knepper * Copyright (c) 2014 Intel Corporation. * * Permission is hereby granted, free of charge, to any person obtaining @@ -30,14 +31,24 @@ int main(int argc, char **argv) { //! [Interesting] + + // Create the Grove LED object using GPIO pin 2 upm::GroveLed* led = new upm::GroveLed(2); + + // Print the name 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++) { led->on(); sleep(1); led->off(); sleep(1); } + + // Delete the Grove LED object + delete led; //! [Interesting] return 0;