Skip to content
Snippets Groups Projects
DIPSwitch.cpp 486 B
Newer Older
13035516's avatar
13035516 committed
#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;
}