mirror of
https://github.com/skogaby/OpeNITHM.git
synced 2026-10-09 15:19:52 +03:00
It didn't build but now it does Fixed the USB def for switching between 32U4/328P Fixes indents on all files
51 lines
935 B
C++
51 lines
935 B
C++
// AirSensor.h
|
|
|
|
#ifndef _AIRSENSOR_h
|
|
#define _AIRSENSOR_h
|
|
|
|
#if defined(ARDUINO) && ARDUINO >= 100
|
|
#include "arduino.h"
|
|
#else
|
|
#include "WProgram.h"
|
|
#endif
|
|
|
|
#include "PinConfig.h"
|
|
#include <EEPROM.h>
|
|
|
|
|
|
|
|
class AirSensor
|
|
{
|
|
private:
|
|
void changeLight(int light);
|
|
void turnOffLight();
|
|
|
|
int thresholds[6];
|
|
int calibrationSamples[6];
|
|
int skippedSamples[6];
|
|
float sensorValues[6];
|
|
int samplesToAcquire;
|
|
int samplesToSkip;
|
|
|
|
bool calibrated[6];
|
|
bool allCalibrated;
|
|
|
|
uint16_t deadzone;
|
|
float alpha;
|
|
public:
|
|
AirSensor(int requiredSamples, int skippedSamples);
|
|
bool isCalibrated();
|
|
bool getSensorState(int sensor);
|
|
int getValue(int sensor, bool light);
|
|
float getHandPosition();
|
|
|
|
void setDeadzone(int deadzone);
|
|
void setAlpha(float alpha);
|
|
int getDeadzone();
|
|
float getAlpha();
|
|
void recalibrate();
|
|
};
|
|
|
|
|
|
#endif
|