Skip to content
This repository was archived by the owner on Sep 19, 2021. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added KCachegrind.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions app/AnalogSensor.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include <AnalogSensor.hpp>
#include <numeric>
#include <vector>

#include <memory>
AnalogSensor::AnalogSensor(unsigned int samples)
: mSamples(samples)
{
Expand All @@ -13,7 +13,7 @@ AnalogSensor::~AnalogSensor()

int AnalogSensor::Read()
{
std::vector<int> *readings = new std::vector<int>(mSamples, 10);
std::shared_ptr<std::vector<int>> readings(new std::vector<int>(mSamples, 10));

double result = std::accumulate( readings->begin(), readings->end(), 0.0 ) / readings->size();
return result;
Expand Down
2 changes: 1 addition & 1 deletion app/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ int main()
{
AnalogSensor lightSensor(5);
std::cout << "Averaged sensor reading: " << lightSensor.Read() << std::endl;
bool terminator;
bool terminator = true;
if( terminator )
{
std::cout << "DONE" << std::endl;
Expand Down
Loading