Newer
Older
#include "DIPSwitch.h"
DIPSwitch::DIPSwitch() {
pin = POT0_PIN;
pot_val = 0;
}
DIPSwitch::DIPSwitch(uint16_t _pin) {
pin = _pin;
pot_val = 0;
}
DIPSwitch::~DIPSwitch() {}
void DIPSwitch::Set_Pin(uint16_t _pin) {
pin = _pin;
}
void DIPSwitch::Set_Pin_Mode() {
pinMode(pin, INPUT);
}
uint16_t DIPSwitch::Get_Pin() {
return pin;
}
void DIPSwitch::Read_DIPSwitch() {
pot_val = analogRead(pin);
}
bool DIPSwitch::Get_Reading() {
return pot_val;
}