mirror of
https://github.com/eclipse/upm.git
synced 2025-07-03 10:21:19 +03:00
Added initial interfaces and some sensors implementing them
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
This commit is contained in:

committed by
Mihai Tudor Panu

parent
6bf21a23e7
commit
f035470822
31
examples/c++/iLight-sample.cxx
Normal file
31
examples/c++/iLight-sample.cxx
Normal file
@ -0,0 +1,31 @@
|
||||
#include <iostream>
|
||||
#include <list>
|
||||
|
||||
#include "apds9002.hpp"
|
||||
#include "bh1750.hpp"
|
||||
#include "max44009.hpp"
|
||||
|
||||
using namespace std;
|
||||
using namespace upm;
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
list<iLight*> lightSensors;
|
||||
|
||||
// Populate list of light sensors
|
||||
lightSensors.push_back(new APDS9002(0));
|
||||
lightSensors.push_back(new BH1750());
|
||||
lightSensors.push_back(new MAX44009(1));
|
||||
|
||||
// Measure luminance level from all 3 individual sensors
|
||||
for (auto& sensor : lightSensors) {
|
||||
sensor->getLuminance();
|
||||
}
|
||||
|
||||
for (auto& sensor : lightSensors) {
|
||||
delete sensor;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
Reference in New Issue
Block a user