#include "arduino.h" class photocell { private: unsigned int _pin; int buffer_size; public: photocell(const unsigned int pin) { _pin = pin; buffer_size = 10; } int value () { float sum = 0; for (int i = 1; i <= buffer_size; i++) { sum += analogRead(_pin); } return round(sum / buffer_size); } };