Skip to content

Instantly share code, notes, and snippets.

@geekscape
Created June 11, 2009 00:44
Show Gist options
  • Save geekscape/127625 to your computer and use it in GitHub Desktop.
Save geekscape/127625 to your computer and use it in GitHub Desktop.
Aiko Device Handler prototype
/* AikoDeviceLightSensorHandler.pde
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* Please do not remove the following notices.
* Copyright (c) 2009 by Geekscape Pty. Ltd.
* Documentation: http://github.com/geekscape/Aiko/tree/master/docs/FILL_ME_IN
* License: GPLv3. http://geekscape.org/static/arduino_license.html
* Version: 0.0
*
* Light Sensor Handler.
*
* To Do
* ~~~~~
* - Implement normalization: 0 - 100 %
* - Put value into a "bucket", which includes an "updated" flag.
* - Create communications handler that automatically dumps the "bucket".
*/
#include <inttypes.h>
// #include <wiring.h>
// #include <HardwareSerial.h>
#include <AikoEvents.h>
using namespace Aiko;
namespace Aiko {
class AikoDeviceLightSensorHandler : public EventHandler {
public:
AikoDeviceLightSensorHandler(uint8_t pin); // = DEFAULT VALUE);
~AikoDeviceLightSensorHandler();
void init(void);
void handler(void);
int getValue(void);
private:
uint8_t pin_;
int value_;
};
};
class AikoDeviceLightSensorHandler : public EventHandler {
AikoDeviceLightSensorHandler(uint8_t pin) {
// Serial.println("ADLSH()");
pin_ = pin;
}
void init(void) {
// Serial.println("ADLSH.init()");
}
void handler(void) {
// Serial.println("ADLSH.handler()");
// value_ = analogRead(pin_);
}
int getValue(void) {
return(value_);
}
private:
uint8_t pin_;
int value_;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment