light: modify so C++ wraps C code

This also provides some more functionality.  get_raw() has been
deprecated in favor of using getNormalized().

Signed-off-by: Jon Trulson <jtrulson@ics.com>
This commit is contained in:
Jon Trulson
2017-03-17 16:18:40 -06:00
parent 27c6ac1d31
commit 54a84af1c3
7 changed files with 204 additions and 62 deletions

View File

@ -34,10 +34,11 @@ main(int argc, char **argv)
// Create the light sensor object using AIO pin 0
upm::Light* light = new upm::Light(0);
// Read the input and print both the raw value and a rough lux value,
// waiting one second between readings
// Read the input and print both the normalized ADC value and a
// rough lux value, waiting one second between readings
while( 1 ) {
std::cout << light->name() << " raw value is " << light->raw_value() <<
std::cout << light->name() << " normalized value is "
<< light->getNormalized() <<
", which is roughly " << light->value() << " lux" << std::endl;
sleep(1);
}